我想安装pip。它应该支持Python 3,但它需要setuptools,这只适用于Python 2。

如何在python3中安装pip ?


当前回答

更新2015-01-20:

根据https://pip.pypa.io/en/latest/installing.html,目前的方式是:

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py

我认为这适用于任何版本


最初的回答:

wget http://python-distribute.org/distribute_setup.py
python distribute_setup.py
easy_install pip

其他回答

我可以通过运行sudo apt-get install python3-pip在Ubuntu上为python3安装pip。

对于Windows 8.1/10操作系统,用户只需打开cmd(命令提示符)

C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python36-32\Scripts

然后

只需要这样写:pip3 install{包的名称}

提示:对于新的python 3, Python36-32文件夹的位置可能不同。x版本

如果你使用命令"python get-pip.py",你应该有Python3的'pip'函数。但是,Python2的'pip'可能仍然存在。在我的例子中,我卸载了'pip',这将它从Python2中删除。

之后,我再次运行“python get-pip.py”。(确保'get-pip.py'保存在与Python3相同的文件夹中。)最后一步是将带有'pip'命令的目录添加到$PATH。这为我解决了问题。

更新2015-01-20:

根据https://pip.pypa.io/en/latest/installing.html,目前的方式是:

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py

我认为这适用于任何版本


最初的回答:

wget http://python-distribute.org/distribute_setup.py
python distribute_setup.py
easy_install pip

如果你使用的是python 3.4+

类型:

python3 -m pip