2016-12-15 256 views
1

我想安裝一些庫來學習機器學習。我說,我需要升級點子的,但是當我試圖除非您使用的virtualenv安裝它無法升級pip

$ 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. 
+0

問題無關用'pycharm'做的,所以我從標籤中刪除它 – haifzhan

+0

非常感謝你 – Imperator123

回答

2

你必須使用sudo運行它。問題是您沒有更改該模塊的權限。使用sudo,您可以授予管理員權限進行更新。

sudo pip install --upgrade pip 
1

的錯誤

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

表明,你不能升級PIP作爲一個普通用戶,你必須運行它sudoer

sudo pip install --upgrade pip