[Tutor] how to permanently add a module path
chris.arndt at web.de
Fri Dec 22 17:07:27 CET 2006
shawn bright schrieb:
> lo there,
> i am working with python in ubuntu, my app has some modules that i would
> like to import from anywhere.
> i can sys.path.append(my_module_dir) but it only lasts as long as
> that python session.
> how can i add a directory to the import path permantly
See point 2)
To set the PYTHONPATH environment variable:
Windows: "Control panel/System/Advanced/Envirnment..." or something similar and
change/add value of PYTHONPATH (entries are separated by semicolons ';')
Depends on your distribution:
- Standard way would be to edit ~/.bash_profile and add e.g.
# entries are separated by colons ':'
but not all desktop environment read this file.
- On Debian, for the system wide environment, you can add the same snippet to
/etc/environment or add a file with the same contents to /etc/profile.d
More information about the Tutor