如何在 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屋!