python - 如何在 Python 3.x 和 Python 2.x 中使用 pip

我安装了 Python 3.x(除了 Ubuntu 上的 Python 2.x)并慢慢开始配对我在 Python 2.x 中使用的模块。

所以我想知道,我应该采取什么方法通过在 Python 2.x 和 Python 3.x 中使用 pip 来简化我的生活?

最佳答案

您应该采取的方法是为 Python 3.2 安装 pip

您可以通过以下方式执行此操作:

$ 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 命令最终会指向其中之一,但我不确定是哪个,所以你必须检查一下。

https://stackoverflow.com/questions/11268501/

相关文章:

python - 为什么使用 Python 的 os 模块方法而不是直接执行 shell 命令?

python - 您需要安装 postgresql-server-dev-X.Y 来构建服务器端扩展

python - 如何将 Pandas 数据添加到现有的 csv 文件中?

python - 为什么我不能在 python 中创建一个轮子?

linux - 从 URL 执行 bash 脚本

linux - 如何在 Bash 中给定超时后杀死子进程?

linux - 在远程 Linux 机器上编译 C++ - "clock skew detected

python - 在 Python 中获取大文件的 MD5 哈希

python - 为什么在 Pylint 认为不正确的条件值中使用 len(SEQUENCE)?

python - Django Admin - 更改标题 'Django administratio