Python adds its own module path, python module path
After entering the Python editing environment, you can use the sys. path attribute of Python to obtain the current search path configuration. You can see that the previously set path is already in the current search path.
Then, you can use sys. path. append ('f: \ Pythonchengxu ') to add the path you have created.
You can see that the instance is successfully added.
However, note that this method is only temporary. The next time you start the interactive interpreter, sys. path will return to the previous state. If you want to add a search path permanently, you can use the following two methods:
Method 2: Modify Environment Variables
W users can modify the system environment variable PYTHONPATH
Method 3: add the. pth file. recommended!
Add a path file in site-packages, for example, mypkpath. pth, which must be suffixed with. pth. Enter the Directory Name of the module file you want to add.
1 windows
C: \ Python27 \ Lib \ site-packages
Add mypkpath. pth to this directory. The content is the address to be changed.