Is there a good workaround to add search path in python?
Hi Slackers,
I have non-official software package in prefix=/usr/local instead of /usr. In Slackware64-current(or maybe all recent Slackware),the official python package has prefix=/usr,which has sys.path like this. Code:
$ python Another problem is that there is sooo many way to do this, like,changing PYTHONPATH,install yet another python in /usr/local, or there are python specific ways like pip and virtualenv. However,I don't use python(at the moment),i just want to change the search path such that the settings is persistent across update/upgrade/adding new software...etc.I would like to see how you guys do it. Thanks |
Open /usr/lib64/python2.7/site.py and find the following lines:
Code:
# Prefixes for site-packages; add additional prefixes like /usr/local here Code:
PREFIXES = [sys.prefix, sys.exec_prefix, '/usr/local'] Code:
import site |
Thank you Audriusk.
Yes,this is the way to do it. Mark it as solved~ |
All times are GMT -5. The time now is 01:24 AM. |