• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

PIP升级OSERROR:[错误:13]权限被拒绝

python 来源:Shivams334 12次浏览

我需要我的Ubuntu系统上升级点子,但我得到的错误:PIP升级OSERROR:[错误:13]权限被拒绝

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: 
     Successfully uninstalled pip-8.1.2 
    Rolling back uninstall of pip 
Exception: 
Traceback (most recent call last): 
    File "/home/shivams334/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main 
    status = self.run(options, args) 
    File "/home/shivams334/.local/lib/python2.7/site-packages/pip/commands/install.py", line 317, in run 
    prefix=options.prefix_path, 
    File "/home/shivams334/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 742, in install 
**kwargs 
    File "/home/shivams334/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 831, in install 
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix) 
    File "/home/shivams334/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 1032, in move_wheel_files 
    isolated=self.isolated, 
    File "/home/shivams334/.local/lib/python2.7/site-packages/pip/wheel.py", line 346, in move_wheel_files 
    clobber(source, lib_dir, True) 
    File "/home/shivams334/.local/lib/python2.7/site-packages/pip/wheel.py", line 317, in clobber 
    ensure_dir(destdir) 
    File "/home/shivams334/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir 
    os.makedirs(path) 
    File "/usr/lib/python2.7/os.py", line 157, in makedirs 
    mkdir(name, mode) 
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pip-9.0.1.dist-info' 
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. 

也许我应该去“CHOWN”,但不知道如何使用它。请帮忙。


===========解决方案如下:

既然你想升级你的系统范围内的Python,您需要使用管理员权限运行该命令:

sudo pip install -U pip 

不过,我建议你不改变/污染您的系统范围的Python。而是使用virtualenv:

virtualenv myapp 
source myapp/bin/activate 
pip install -U pip # <- only if virtualenv is not up to date 

版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)