繁体   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