我想安装pip。它应该支持Python 3,但它需要setuptools,这只适用于Python 2。
如何在python3中安装pip ?
我想安装pip。它应该支持Python 3,但它需要setuptools,这只适用于Python 2。
如何在python3中安装pip ?
当前回答
我可以通过运行sudo apt-get install python3-pip在Ubuntu上为python3安装pip。
其他回答
老版本的Homebrew
如果你使用的是macOS系统,请使用自制软件。
brew install python3 # this installs python only
brew postinstall python3 # this command installs pip
还要注意,如果安装成功完成,您应该检查控制台。有时它不会(例如,由于所有权导致的错误),但人们只是忽略了日志。
更新- 1.5之后的自制版本
Homebrew官方页面显示:
2018年3月1日,python公式将升级到python 3。x和一个python@2公式将用于安装Python 2.7(尽管这将是keg-only,因此Python和python2在默认情况下都不会被添加到PATH中,除非手动酿造链接——force)。我们将维护python2、python3和python@3别名。
因此,要安装Python 3,请运行以下命令:
brew install python3
然后自动安装pip,您可以通过pip install <package>安装任何包。
python3 -m ensurepip
我不确定这是什么时候引入的,但是当它还不存在的时候,我为它安装了pip3。
对于Ubuntu 12.04或更高版本,
sudo apt-get install python3-pip
不能工作。相反,使用:
sudo apt-get install python3-setuptools ca-certificates
sudo easy_install3 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
在安装Python时,pip会一起安装。你可以使用 Sudo PIP安装(模块) 或 Python3 -m PIP安装(模块)。