Storage Location PYTHONPATH

Where is my pythonpath stored? When I write

import sys
sys.path

Where does Python get this data?

+3
source share
1 answer

Python gets this data from the module's path attribute sys. This path is list, and if you want to add a new path to the path, just use the method append.

For example, to add a directory /home/me/mypyto a path, simply do:

import sys
sys.path.append("/home/me/mypy")
+2
source

Source: https://habr.com/ru/post/1758190/


All Articles