我的 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/