Where should the python independent library version go?

I have a clean python module that will work for both Python 2.6 and 2.7. Instead of putting the module in specific paths to the python version, is it possible to place the library in one place to which both Python 2.6 and 2.7 will be available? System - Ubuntu.

+8
python linux ubuntu version
source share
2 answers

You can install the library in one place, for example /opt , and then create two soft links inside /usr/lib/python2.6 and /usr/lib/python2.7 , pointing to this library.

+3
source share

By default, python26 searches for modules in the / python 2.6 / folders, and python27 searches in the / python 2.7 / folders.

One way to achieve your goal would be to add a different (common) location to the system path by changing the PYTHONPATH system variable:

 export PYTHONPATH=/common/location 
+1
source share

All Articles