我正在为我构建的一个使用 Basemap 的简单工具构建一个独立的可执行文件。(使用 Python 2.7,使用开发版 PyInstaller - 2.1)。.exe(单个文件)构建得很好,但是当它运行时,我收到以下错误:
Traceback <most recent call last>:
File "<string>", line 9, in <module>
File "c:\python27\lib\site-packages\PyInstaller-2.1dev_-py2.7.egg\PyInstaller\loader\pyi_importers.py", line 270, in load_module
exec<bytecode, module.__dict>
File "C:\Documents and Settings\MYNAME\Python code\Flood\src\root\nested\build\FloodRisk\out00-PYZ.pyz\mpl_toolkits.basemap", line 30, in <module>
File "c:\python27\lib\site-packages\PyInstaller-2.1dev_-py2.7.egg\PyInstaller\loader\pyi_importers.py", in load_module
exec<bytecode, module.__dict__>
File "C:\Documents and Settings\MYNAME\My Documents\Python code\Flood\src\root\nested\build\FloodRisk\out00-PYZ.pyz\mpl_toolkits.basemap.pyproj", line 242, in <module>
IOError: proj data directory not found. Expecting it at: C:\DOCUME~1\MYNAME\LOCALS~1\Temp\_MEI68362\mpl_toolkits\basemap\data
任何人都可以让 Basemap 正确加载到使用 PyInstaller 构建的单个 .exe 文件中吗?我正在使用一个非常简单的批处理文件进行构建:
C:\Python27\python.exe "C:\Python27\Lib\site-packages\pyinstaller-develop\PyInstaller\main.py" --onefile "C:\Documents and Settings\MYNAME\My Documents\Python code\Flood\src\root\nested\FloodRisk.py"
pause
谢谢!