Computer >> Computer tutorials >  >> Programming >> Python

What is PYTHONPATH environment variable in Python?


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: https://docs.python.org/using/cmdline.html#environment-variables