Python pathIndicates the path for python to load resources. For example, if you want to import related Python modules to a python file, you need to find them in the python environment.
Where are the python compiling environments looking for them?
The answer is in Python path. Python path is a list composed of some Python paths. The Python compiling environment keeps searching for the path of this module in the list, by default, it seems to start from the python built-in package. If this module is found, compile it and generate the PyC file to facilitate the next import. If not, an error will be reported.
If the module is not found, try the following solutions.
1. Use OS. SYS. Path to view all Python paths in the current Python environment. This means that the imported modules are not added to the python path.
2 If not, OS. SYS. path. append (), but this is temporary. If it is permanent, we recommend that you put the module under the site-packages directory under the python directory, this directory is used by Python extension modules and standard libraries.
Read the aboveArticleWe recommend that you check the usage of Python SYS. Path.
Original article please indicate Reprinted from Old Wang python, this article address: http://www.cnpythoner.com/post/84.html
Author: Lao Wang @ Python tutorial
Old Wang Python provides Python-related Django tutorials and Python downloads.