无法在python 2.7上安装pip,仅在python 3上 [英] Can't install pip on python 2.7, only python 3

查看:78
本文介绍了无法在python 2.7上安装pip,仅在python 3上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试为python 2.7安装pip,但我无法安装.我希望pip适用于python 2.7和python3.这是到目前为止我所做的总结:

I have been trying to install pip for python 2.7, but I am unable to. I want pip to work for both python 2.7 and python 3. Here is a summary of what I have done so far:

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').我相信应该只有一个?

I've also done a few checks to know where everything is (I have two '/usr/local/bin/python'). I believe there should only be one?

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却什么也没有

I only get results for python3, nothing at all for python2

/usr/local/Cellar/python/3.6.5/bin/pip3

我尝试过的不起作用的事情包括:

Things I have tried that do not work, include:

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文件下载

To download get_pip.py file run

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

然后尝试

python get-pip.py

文档在这里: https://pip.pypa.io/en/stable/installing/

这篇关于无法在python 2.7上安装pip,仅在python 3上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆