我想安装pip。它应该支持Python 3,但它需要setuptools,这只适用于Python 2。
如何在python3中安装pip ?
我想安装pip。它应该支持Python 3,但它需要setuptools,这只适用于Python 2。
如何在python3中安装pip ?
当前回答
如果您的Linux发行版已经安装了Python,那么您应该能够使用系统的包管理器安装PIP。这是可取的,因为系统安装的Python版本不能很好地使用在Windows和Mac上使用的get-pip.py脚本。
高级软件包工具(Python 2.x)
sudo apt-get install python-pip
高级软件包工具(Python 3.x)
sudo apt-get install python3-pip
包管理器(Python 2.x)
sudo pacman -S python2-pip
包管理器(Python 3.x)
sudo pacman -S python-pip
Yum Package Manager (Python 2.x)
sudo yum upgrade python-setuptools
sudo yum install python-pip python-wheel
Yum Package Manager (Python 3.x)
sudo yum install python3 python3-wheel
Dandified Yum (Python 2.x)
sudo dnf upgrade python-setuptools
sudo dnf install python-pip python-wheel
Dandified Yum (Python 3.x)
sudo dnf install python3 python3-wheel
Zypper包管理器(Python 2.x)
sudo zypper install python-pip python-setuptools python-wheel
Zypper包管理器(Python 3.x)
sudo zypper install python3-pip python3-setuptools python3-wheel
其他回答
下面是我在ubuntu 12.04中解决这个问题的方法:
sudo apt-get install build-essential libncursesw5-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev
然后从源代码安装python3:
wget https://www.python.org/ftp/python/3.4.0/Python-3.4.0.tar.xz
tar xvf Python-3.4.0.tar.xz
cd Python-3.4.0
./configure
make
make test
sudo make install
当您完成所有这些程序的安装后,pip3将自动安装。
python3 -m ensurepip
我不确定这是什么时候引入的,但是当它还不存在的时候,我为它安装了pip3。
如果你使用的是python 3.4+
类型:
python3 -m pip
要安装pip,请安全地下载get-pip.py。
然后执行如下命令:
python get-pip.py
如果您使用的Python安装由您的 操作系统或其他包管理器。py没有 与这些工具进行协调,可能会使您的系统处于一个 不一致的状态。
参考:PIP安装
如果您的Linux发行版已经安装了Python,那么您应该能够使用系统的包管理器安装PIP。这是可取的,因为系统安装的Python版本不能很好地使用在Windows和Mac上使用的get-pip.py脚本。
高级软件包工具(Python 2.x)
sudo apt-get install python-pip
高级软件包工具(Python 3.x)
sudo apt-get install python3-pip
包管理器(Python 2.x)
sudo pacman -S python2-pip
包管理器(Python 3.x)
sudo pacman -S python-pip
Yum Package Manager (Python 2.x)
sudo yum upgrade python-setuptools
sudo yum install python-pip python-wheel
Yum Package Manager (Python 3.x)
sudo yum install python3 python3-wheel
Dandified Yum (Python 2.x)
sudo dnf upgrade python-setuptools
sudo dnf install python-pip python-wheel
Dandified Yum (Python 3.x)
sudo dnf install python3 python3-wheel
Zypper包管理器(Python 2.x)
sudo zypper install python-pip python-setuptools python-wheel
Zypper包管理器(Python 3.x)
sudo zypper install python3-pip python3-setuptools python3-wheel