如何使用Python 3安装pip? [英] How to install pip with Python 3?

查看:173
本文介绍了如何使用Python 3安装pip?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要安装 pip .它应支持Python 3,但需要setuptools,该工具仅适用于Python 2.

I want to install pip. It should support Python 3, but it requires setuptools, which is available only for Python 2.

如何在Python 3中安装pip?

How can I install pip with Python 3?

推荐答案

手动安装和使用setuptools不再是标准过程.

edit: Manual installation and use of setuptools is not the standard process anymore.

恭喜,您应该已经安装了pip.如果没有,请继续阅读.

Congrats, you should already have pip installed. If you do not, read onward.

如果您的Python版本低于2.7.9或3.4,或者您的系统出于某种原因未包含该软件包,通常可以通过软件包管理器为pip安装软件包.

You can usually install the package for pip through your package manager if your version of Python is older than 2.7.9 or 3.4, or if your system did not include it for whatever reason.

随后是一些更常见发行版的说明.

Instructions for some of the more common distros follow.

从终端运行以下命令:

sudo apt-get install python-pip 

在Debian(Wheezy和更高版本)和Ubuntu(Trusty Tahr和更高版本)上安装Python 3.x

从终端运行以下命令:

Installing on Debian (Wheezy and newer) and Ubuntu (Trusty Tahr and newer) for Python 3.x

Run the following command from a terminal:

sudo apt-get install python3-pip

注意:

在全新的Debian/Ubuntu安装中,只有在执行以下操作后才能找到该软件包:

Note:

On a fresh Debian/Ubuntu install, the package may not be found until you do:

sudo apt-get update

在Python 2.x的CentOS 7上安装pip

在CentOS 7上,您必须先安装设置工具,然后再使用它来安装pip,因为它没有直接的软件包.

Installing pip on CentOS 7 for Python 2.x

On CentOS 7, you have to install setup tools first, and then use that to install pip, as there is no direct package for it.

sudo yum install python-setuptools
sudo easy_install pip

在Python 3.x的CentOS 7上安装pip

假设您从EPEL安装了Python 3.4 ,则可以安装Python 3的设置工具并使用它进行安装pip.

Installing pip on CentOS 7 for Python 3.x

Assuming you installed Python 3.4 from EPEL, you can install Python 3's setup tools and use it to install pip.

# First command requires you to have enabled EPEL for CentOS7
sudo yum install python34-setuptools
sudo easy_install pip

如果您的Unix/Linux发行版中没有repos包

使用下面详细介绍的手动方法进行安装.

If your Unix/Linux distro doesn't have it in package repos

Install using the manual way detailed below.

如果要手动进行操作,现在推荐的方法是使用

If you want to do it the manual way, the now-recommended method is to install using the get-pip.py script from pip's installation instructions.

安装点子

要安装pip,请安全下载 get-pip.py

To install pip, securely download get-pip.py

然后运行以下命令(可能需要管理员访问):

Then run the following (which may require administrator access):

python get-pip.py 

如果尚未安装setuptools,则get-pip.py将为您安装setuptools.

If setuptools is not already installed, get-pip.py will install setuptools for you.

这篇关于如何使用Python 3安装pip?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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