What is PYTHONPATH environment variable in Python?

PythonServer Side ProgrammingProgramming

PYTHONPATH is an environment variable which you can set to add additional directories where python will look for modules and packages. For most installations, you should not set these variables since they are not needed for Python to run. Python knows where to find its standard library.

The only reason to set PYTHONPATH is to maintain directories of custom Python libraries that you do not want to install in the global default location (i.e., the site-packages directory).

Read the following docs to get a better understanding of Python environment variables: http://docs.python.org/using/cmdline.html#environment-variables

Updated on 30-Jul-2019 22:30:20