[Tutor] how to add directory to python search list

Alan Gauld alan.gauld at btinternet.com
Sat Jul 16 08:18:27 CEST 2011


Surya P.K. Kasturi wrote:
> OS : Ubuntu Linux
> Python Version : 2.6.4
> 
> I have some third party modules to be installed in my computer.
> So, I want to add the module directory to python search list.
> 
> I used :
> 
> *>>> import sys*
> *>>> sys.path.append('directory address')*
> *
> *
> this could do my work but as soon as I close the terminal and reopen it, I

You need to add the folder to your PYTHONPATH environment variable.
You usually do this your .login or .profile file.

Python will add the contents of PYTHONPATH to sys.path on startup.

HTH,


Alan G



More information about the Tutor mailing list