Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install python module for non-default version on linux

I have different python versions installed on my ubuntu machine. The default version is 2.7.

So when I install any new python module, for example using:

#apt-get install python-nfqueue

it will be istalled just for the default version (2.7)

How can I install the new modules for the other versions? Is there a way to do it using apt-get install?

Thank you!

like image 370
HaTiMuX Avatar asked Mar 15 '26 04:03

HaTiMuX


2 Answers

You should install Python libraries with the Python package installer, pip.

Create a virtualenv with the Python version you want to use, activate it, and do pip install NetfilterQueue. You'll still need to install the system dependencies (eg libnetfilter-queue-dev in this case) with apt-get.

like image 178
Daniel Roseman Avatar answered Mar 16 '26 16:03

Daniel Roseman


You can install pip to work with different versions of python. Here is a link to the pip read the docs page(http://pip.readthedocs.org/en/latest/installing.html).

to install pip to the default version of python on your machine:

python get-pip.py 

to install for non standard versions call python with the version you wish to install for:

python33 get-pip.py 

you can then run pip for python version 3.3 by calling

pip33 install pythonmodule
like image 22
Django Fett Avatar answered Mar 16 '26 17:03

Django Fett



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!