我有一个脚本“splash.py”存储在 C:\Users\cedwards\saved_scripts
我已经在变量“路径”(环境变量)的系统变量中添加了这个目录
当我打印 sys.path 中的所有值时,我得到..
>>> import sys
>>> for val in sys.path:
... print val
...
C:\Python27\lib\site-packages\openpyxl-2.3.2-py2.7.egg
C:\Python27\lib\site-packages\et_xmlfile-1.0.1-py2.7.egg
C:\Python27\lib\site-packages\jdcal-1.2-py2.7.egg
C:\Python27\Lib
*C:\Python27\Scripts\* C:\Python27\DLLs
*C:\Python27\Scripts\* C:\Python27\Lib\lib-tk
*C:\Python27\Scripts\* C:\Users\cedwards\saved_scripts
C:\WINDOWS\system32\python27.zip
C:\Python27\DLLs
C:\Python27\lib\plat-win
C:\Python27\lib\lib-tk
C:\Python27
C:\Python27\lib\site-packages
C:\Python27\lib\site-packages\win32
C:\Python27\lib\site-packages\win32\lib
C:\Python27\lib\site-packages\Pythonwin
C:\Python27\lib\site-packages\wx-2.8-msw-unicode
>>>
斜体的值不应该在那里?我在 PATH 中输入的值是“C:\Python27\lib\site-packages\openpyxl-2.3.2-py2.7.egg;C:\Python27\lib\site-packages\et_xmlfile-1.0.1-py2。 7.egg;C:\Python27\lib\site-packages\jdcal-1.2-py2.7.egg;C:\Python27\Lib;C:\Python27\DLLs;C:\Users\cedwards\saved_scripts;C: \WINDOWS\system32\python27.zip;C:\Python27\lib\plat-win;C:\Python27\lib\lib-tk;C:\Python27;C:\Python27\lib\site-packages;C:\ Python27\lib\site-packages\win32;C:\Python27\lib\site-packages\win32\lib;C:\Python27\lib\site-packages\Pythonwin;C:\Python27\lib\site-packages\wx -2.8-msw-unicode"
Obvioulsy,当我尝试在新脚本中导入 splash 时,它不起作用。
我的问题是,为什么 *C:\Python27\Scripts* 重复?我认为这是阻止我的模块被导入的原因。