2015-11-05 129 views
1

Python Version=2.7, 3.4 所以我試圖更新點子,因爲我在終端中收到以下消息。 您正在使用pip版本7.0.3,但是版本7.1.2可用。 您應該考慮通過'pip install --upgrade pip'命令進行升級。Python2.7,33的pip安裝/升級錯誤

和這個。

Collecting pip 
Using cached pip-7.1.2-py2.py3-none-any.whl 
Installing collected packages: pip 
Found existing installation: pip 7.0.3 
Uninstalling pip-7.0.3: 

,然後我得到一個錯誤,指出,

Exception: 
    Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/basecommand.py", line 223, in main 
    status = self.run(options, args) 
    File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/commands/install.py", line 297, in run 
    root=options.root_path, 
    File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/req/req_set.py", line 616, in install 
    requirement.uninstall(auto_confirm=True) 
    File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/req/req_install.py", line 721, in uninstall 
    paths_to_remove.remove(auto_confirm) 
    File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/req/req_uninstall.py", line 126, in remove 
    renames(path, new_path) 
    File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/utils/__init__.py", line 314, in renames 
    shutil.move(old, new) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 300, in move 
    rmtree(src) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 247, in rmtree 
    rmtree(fullname, ignore_errors, onerror) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 252, in rmtree 
    onerror(os.remove, fullname, sys.exc_info()) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 250, in rmtree 
    os.remove(fullname) 
    OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/EGG-INFO/dependency_links.txt' 

如何解決這個問題?

回答

1

安裝需要您沒有的文件權限。 以sudo(sudo pip install ...)或root用戶身份運行。你將需要root密碼。

unix標準文件系統層次結構就是這樣一個普通用戶(即使是管理員)對homedir外部大多數地方沒有寫入權限。要改變層次結構的「全局」路徑中的內容,您需要擁有更高的權限。根一般是高權限用戶。通過sudo前綴來運行命令意味着將其作爲另一個用戶運行,並且通常具有root權限,然後可以寫入pip正試圖安裝的位置/ Library等位置。

一些更多的關於標準:https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

0

嘗試從/Library/Python/2.7/刪除PIP-7.0.3-py2.7.eggPIP .pth *站點包/然後嘗試在終端

+0

執行PIP安裝--upgrade PIP命令只使用PIP卸載--name--? cuz我試過了,它沒有做任何事情,但給了我一個錯誤,說'不能卸載要求pip-7.0.3(和py2.7.egg)未安裝' –

+0

maily當有任何文件權限問題時... –