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 permanently add a directory to PYTHONPATH?
|
||||
|
You need to add your new directory to the environment variable
|
|||||||||||||
|
If you're using bash (on a Mac or GNU/Linux distro), add this to your
|
|||||||||||||||||||||
|
You could add the path via your pythonrc file, which defaults to ~/.pythonrc on linux. ie.
You could also set the |
|||||
|
Just to add on awesomo's answer, you can also add that line into your |
||||
|
Instead of manipulating
For some reason this doesn't seem to work in Python 2.7. There you can use:
Then create a For example:
|
|||||||||||||||||||||
|
In case anyone is still confused - if you are on a Mac, do the following:
|
|||
|
On linux you can create a symbolic link from your package to a directory of the PYTHONPATH without having to deal with the environment variables. Something like:
|
|||
|
For me it worked when I changed the For python 2.7 it should look like:
at the end of the |
||||
|