---

How to change sys.path or PYTHONPATH in Python

When the Python interpreter executes a program which imports a module, it examines all directory paths listed in sys.path until it finds the module. By default, sys.path is constructed as a concatenation of (1) the current working directory, (2) content of PYTHONPATH environment variable, and (3) a set of default paths supplied by the installed Python interpreter.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis