简体   繁体   English

pip和Python在不同的路径

[英]pip and Python in different paths

I've been having some trouble installing Python packages and then I noticed that pip and Python were in different spots, which could be the problem. 我在安装Python软件包时遇到了一些麻烦,然后我注意到pip和Python处于不同的位置,这可能是问题所在。 How do I align them back up? 如何将它们对齐?

Macintosh:~ Ryan$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
Macintosh:~ Ryan$ which pip
/Library/Frameworks/Python.framework/Versions/3.5/bin/pip

And

Macintosh:~ Ryan$ python -V
Python 2.7.11
Macintosh:~ Ryan$ pip -V
pip 8.1.2 from /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (python 3.5)

I'd like for everything to use 2.7 and hoping that fixing this will stop me from getting so many errors/notifications when I try to install certain packages like this: 我想要一切都使用2.7并希望修复这个会阻止我在尝试安装这样的包时遇到这么多错误/通知:

Macintosh:~ Ryan$ pip install json
Collecting json
  Could not find a version that satisfies the requirement json (from versions: )
No matching distribution found for json

If you want to set up pip for 2.7, just download get-pip.py and run 如果你想设置2.7的pip ,只需下载get-pip.py并运行即可

sudo /Library/Frameworks/Python.framework/Versions/2.7/bin/python get-pip.py

and it will install pip and pip2 for you in the same bin directory as the python executable. 它将在python可执行文件所在的bin目录中为你安装pippip2 You should still be able to install packages for Python 3 using pip3 or pip-3.5 . 您仍然可以使用pip3pip-3.5安装Python 3的软件包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM