PYTHONPATH vs PATH?

Rene Pijlman reply.in.the.newsgroup at my.address.is.invalid
Mon May 8 10:22:17 EDT 2006


Fredrik Lundh:
>PATH is used by the operating system to find executables, and PYTHONPATH
>is used by Python to find Python modules.

Yes, but Python also finds modules in its own installation. So changing
PATH may cause another installation of Python to be run, which may have
some other set of installed modules.

"When a module named spam is imported, the interpreter searches for a file
named spam.py in the current directory, and then in the list of
directories specified by the environment variable PYTHONPATH. This has the
same syntax as the shell variable PATH, that is, a list of directory
names. When PYTHONPATH is not set, or when the file is not found there,
the search continues in an installation-dependent default path; on Unix,
this is usually .:/usr/local/lib/python."
http://docs.python.org/tut/node8.html

-- 
René Pijlman



More information about the Python-list mailing list