我试图使用 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
最佳答案
我看你有
OSError: [Errno 13] Permission denied:
这意味着您需要 root 访问权限才能安装该软件包。 因为您没有安装在虚拟环境中。它正在为全局系统安装。
尝试使用 sudo
关于python - 无法升级我的 pip 版本。我的设置有问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33838790/