Answer the question
In order to leave comments, you need to log in
How to specify the places where the python interpreter searches?
How to specify the places where the python interpreter searches?
I write modules and import them using import. But the interpreter looks for modules only from the folder in which the program itself is located. How to make the interpreter look for modules in other places?
Answer the question
In order to leave comments, you need to log in
In addition to the way indicated in the adjacent answer, there is another way to do this from the python program itself:
import sys
sys.path.append('some/custom/path/to/modules_and_packages_collection_folder')
https://andreyex.ru/yazyk-programmirovaniya-python...
PYTHONPATH
It has the same PATH role. This variable tells the Python interpreter where to find the module files imported into the program. Must include the Python source library directory and directories containing the Python source code. PYTHONPATH is sometimes pre-set by the Python installer.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question