我一直在尝试为python 2.7安装pip,但我无法做到.我想要pip为python 2.7和python 3工作.这是我到目前为止所做的总结:
python -V
Python 2.7.15
echo $PATH
... /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin ...
我还做了一些检查,知道一切都在哪里(我有两个’/usr/local/bin / python’).我相信应该只有一个?
which -a python
/usr/local/bin/python
/usr/local/bin/python
/usr/bin/python
which python
/usr/local/bin/python
ls -l $(which python)
lrwxr-xr-x 1 XXXXX admin 36 May 24 14:28 /usr/local/bin/python -> ../Cellar/python@2/2.7.15/bin/python
当我做:
brew list python | grep pip
我只得到python3的结果,对python2一点都没有
/usr/local/Cellar/python/3.6.5/bin/pip3
我尝试过的东西不起作用,包括:
python get-pip.py
"can't open file 'get-pip.py': [Errno 2] No such file or directory"
brew install pip
"Error: No available formula with the name "pip" "
我感谢您的帮助!
解决方法:
下载get_pip.py文件运行
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
然后试试
python get-pip.py
文件在这里:
https://pip.pypa.io/en/stable/installing/