簡體   English   中英

如何使用Python 3的PIP版本進行指定(或為什么PIP無法正常工作)

[英]How to specify using Python 3's Version of PIP (or why isn't PIP working)

我有一台同時安裝了Python 2.7.6 (默認情況下)和Python 3.4.0 (我自己)的mac。

我認為我可能還安裝了多個版本的PIP。 (當我運行PIP --versionpip 1.5.6 from /Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg (python 2.7)得到pip 1.5.6 from /Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg (python 2.7)

但是我知道Python 3帶有1.5.4版本。

因此,我的問題是:

答:如何確定我是否安裝了多個版本的pip

B.如果確實安裝了多個版本,如何指定要使用哪個版本,或者應該將安裝的軟件包放在何處?

我嘗試了這里概述的建議(基本上使用pip-3.4 ),但是command not found

所有這些的原因是,當嘗試使用pip安裝任何軟件包時,甚至只是為了更新( pip install --upgrade pip ),我都會遇到以下錯誤

Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/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-1.5.6-py2.7.egg/pip/req.py", line 1431, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 598, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1836, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/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 299, 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-1.5.6-py2.7.egg/EGG-INFO/dependency_links.txt'

Storing debug log for failure in /Users/Startec/Library/Logs/pip.log

就像python被符號鏈接到您的Python 2版本一樣, pip被符號鏈接到Python 2的pip。

相反,請使用pip3 ,該pip3應引用活動的Python 3安裝(可使用python3訪問)。 您也可以使用完整的版本名稱,但不能使用破折號: pip3.4

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM