Whenever I use sys.path.append
, the new directory will be added. However, once I close python, the list will revert to the previous (default?) values. How do I
You could add the path via your pythonrc file, which defaults to ~/.pythonrc on linux. ie.
import sys
sys.path.append('/path/to/dir')
You could also set the PYTHONPATH
environment variable, in a global rc file, such ~/.profile
on mac or linux, or via Control Panel -> System -> Advanced tab -> Environment Variables on windows.