无法升级我的pip版本。我的设置有问题

时间:2015-11-21 01:43:51

标签: python pip

我试图使用pip安装一些东西,并且我不断收到此UserWarning错误(见下文)。

我尝试升级pip,你可以看到下面的错误。

我有一段时间没有在我的系统上使用过python而且它似乎被打破了。它可能是什么?

pip install -U pip
/usr/local/bin/pip:5: UserWarning: Module _markerlib was already imported from /Library/Python/2.7/site-packages/distribute-0.6.49-py2.7.egg/_markerlib/__init__.pyc, but /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python is being added to sys.path
  from pkg_resources import load_entry_point
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-7.1.2-py2.py3-none-any.whl#md5=5ff9fec0be479e4e36df467556deed4d
  Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB): 1.1MB downloaded
Installing collected packages: pip
  Found existing installation: pip 1.5.6
    Uninstalling pip:
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/Library/Python/2.7/site-packages/pip/req.py", line 1431, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req.py", line 598, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req.py", line 1836, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip/util.py", line 295, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-1.5.6.dist-info/DESCRIPTION.rst'

Storing debug log for failure in /Users/blankman/Library/Logs/pip.log

2 个答案:

答案 0 :(得分:6)

我看到你有

OSError: [Errno 13] Permission denied:

这意味着您需要root权限才能安装该软件包。 因为你没有安装在虚拟环境中。它正在为全球系统安装。

尝试使用sudo

答案 1 :(得分:1)

只是您需要root访问才能更改或更新

尝试:sudo apt-get install pip --upgrade

或:sudo pip install -U pip

或:sudo pip install pip --upgrade