如何在Python 3.x和Python 2.x上使用pip [英] How to use pip with Python 3.x alongside Python 2.x
问题描述
我安装了Python 3.x(除了Ubuntu上的Python 2.x),然后慢慢开始配对我在Python 2.x中使用的模块.
I installed Python 3.x (besides Python 2.x on Ubuntu) and slowly started to pair modules I use in Python 2.x.
所以我想知道,应该为Python 2.x和Python 3.x使用pip来简化生活吗?
So I wonder, what approach should I take to make my life easy by using pip for both Python 2.x and Python 3.x?
推荐答案
您应该采取的方法是为Python 3.2安装pip
.
The approach you should take is to install pip
for Python 3.2.
您可以通过以下方式进行操作:
You do this in the following way:
$ curl -O https://bootstrap.pypa.io/get-pip.py
$ sudo python3.2 get-pip.py
然后,您可以使用pip-3.2
安装适用于Python 3.2的内容,并使用pip-2.7
安装适用于Python 2-7的内容. pip
命令最终将指向其中之一,但是我不确定是哪一个,因此您必须进行检查.
Then, you can install things for Python 3.2 with pip-3.2
, and install things for Python 2-7 with pip-2.7
. The pip
command will end up pointing to one of these, but I'm not sure which, so you will have to check.
这篇关于如何在Python 3.x和Python 2.x上使用pip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!