Unable to upgrade pip

百般思念 提交于 2020-02-03 10:22:45

问题


I wanted to install some libraries to learn machine learning. I say's that i need to upgrade pip, but when i tried to install it

$ pip install --upgrade pip
Collecting pip
  Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 8.1.2
    Uninstalling pip-8.1.2:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 736, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 742, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 303, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-8.1.2.dist-info/DESCRIPTION.rst'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

回答1:


You have to run it with sudo unless you are using a virtualenv. The problem is that you don't have the permission to change that module. With sudo, you are giving administrator's permissions to update it.

sudo pip install --upgrade pip



回答2:


The Error

OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-8.1.2.dist-info/DESCRIPTION.rst'

showed that you are not allowed to upgrade pip as a regular user, You have to run it as sudoer

sudo pip install --upgrade pip




回答3:


Windows:

1) Close the current command prompt window.

2) Open it again, but as admin: right click and choose: "Run as administrator"

Linux or Unix:

Start the command with "sudo" as Tim and Haifeng mentiond.



来源:https://stackoverflow.com/questions/41172757/unable-to-upgrade-pip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!