path - Python Import From Specific Location (Multiple Libraries Installed) -


i have installed library (mylib) default installation directory /usr/bin/... , then, installed same library different folder using:

python setup.py install --prefix=/tmp/python/ 

so, right now, have 2 same library installed on different folders.

however, don't want delete either of them. want call version /tmp/python/mylib, how in python script.

#pseudo code mypath = "/tmp/python/" import mypath.mylib ... 

you do:

import sys sys.path.insert(0, '/tmp/python/')  import mylib 

or change environment variable path when run script:

$ path=/tmp/python/ you_script 

but better use virtualenv. , virtualenvwrapper maybe.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -