python - 在 linux 上为非默认版本安装 python 模块

标签 python linux python-module

我的 ubuntu 机器上安装了不同的 python 版本。默认版本为 2.7。

所以当我安装任何新的 python 模块时,例如使用:

#apt-get install python-nfqueue

它将仅针对默认版本 (2.7) 安装

如何为其他版本安装新模块? 有没有办法使用 apt-get install 来做到这一点?

谢谢!

最佳答案

您应该使用 Python 包安装程序 pip 安装 Python 库。

使用您要使用的 Python 版本创建一个 virtualenv,激活它,然后执行 pip install NetfilterQueue。您仍然需要使用 apt-get 安装系统依赖项(例如 libnetfilter-queue-dev)。

关于python - 在 linux 上为非默认版本安装 python 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25162141/

相关文章:

用于任务管道的 Python 模式

python - 使用 Python 自动从 ASPX 网站下载文件

python - 为什么多线程快速排序比Python中的普通快速排序慢?

c - Linux 的 dos.h?

python - 摆脱 easy_install 消息 : : module references __file__

python - 子类不识别父类的模块导入?

python - 为什么python会忽略带有dict.keys()的if语句?

linux - 删除 xinetd 导致 plesk 删除

linux - 更改apache2网络服务器中的密码 - 摘要身份验证

Python 在另一个文件中导入模块