-
module search path
When the interpreter executes import statement(like
import sys
) from any module, it searches forsys.py
in a list of directories assembled from the following sources:-
The directory from which the input script was run, or the current directory if the interpreter is being run interactively
-
The list of directories contained in the PYTHONPATH environment variable, if it is set.(The format for PYTHONPATH is OS-dependent but should mimic the PATH environment)
-
An installation-dependent list of directories configured configured at the time Python is installed
-
-
how to get it
The resulting search path is accessible in the Python variable sys.path, which is obetained from a module named sys:
理解module search path in Python
最新推荐文章于 2024-08-21 20:49:35 发布