2016-12-25 116 views
-1

我需要我的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」,但不知道如何使用它。請幫忙。

+1

你運行了哪個命令?你使用sudo了嗎? – Biffen

+0

@Biffen謝謝你的回覆。不,我使用'pip install --upgrade pip' – Shivams334

+0

他嘗試'pip install -U pip' ... –

回答

0

既然你想升級你的系統範圍內的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 
相關問題