用户手册中没有解释如何实现这一点。虽然有几个可能的位置可以输入这些信息(例如两个“activate”文件),但在它们中添加额外的PATH信息没有效果。
那么该怎么做呢?
DN
setenv PYTHONPATH /Users/<username>/Python/:/Users/<username>/AnotherPath/
,所描述的问题在Win 7 Canopy安装中也会出现。
我尝试将要导入的文件放置在sys.path()提供的几个位置中。
['', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\User\Scripts\python27.zip', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.0.1160.win-x86_64\DLLs', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.0.1160.win-x86_64\lib', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.0.1160.win-x86_64\lib\plat-win', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.0.1160.win-x86_64\lib\lib-tk', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.0.1160.win-x86_64', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\User', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\User\lib\site-packages', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\System', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\System\lib\site-packages', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\System\lib\site-packages\PIL', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\System\lib\site-packages\win32', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\System\lib\site-packages\win32\lib', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\System\lib\site-packages\Pythonwin', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.0.1160.win-x86_64\lib\site-packages', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.0.1160.win-x86_64\lib\site-packages\IPython\extensions']
我找到的唯一解决方案是使用:sys.path.append()