python environment variable PYTHONPATH

Original link: http://www.cnblogs.com/GODYCA/archive/2013/05/31/3110410.html

Python PYTHONPATH search path is, by default we import the module from PYTHONPATH will find inside.

   Use the following code can be printed PYTHONPATH:

print (os.sys.path)

   PYTHONPATH one of my items are as follows:

Copy the code
[
'D:\\Python3\\workspace\\PythonLab\\src',
'D:\\aptana3\\plugins\\org.python.pydev_2.7.0.2012080220\\pysrc',
'D:\\Python3\\python33.zip', 'D:\\Python3\\DLLs',
'D:\\Python3\\lib',
'D:\\Python3',
'D:\\Python3\\lib\\site-packages'
]
Copy the code

   For example, I use the following import statement:

import urllib

   Python interpreter will choose a path-by-path from the list above and then search until you find urllib module. Finally, here in the D: find \ Python3 under \ lib, as shown below:

Reproduced in: https: //www.cnblogs.com/GODYCA/archive/2013/05/31/3110410.html

Guess you like

Origin blog.csdn.net/weixin_30410999/article/details/94787447