我正在使用pysal创建DBF文件,尽管该代码在Eclipse环境中运行良好,但是pyinstaller创建的exe出现以下错误:
Traceback (most recent call last):
File "MCC_SLD_prep.py", line 14, in <module>
import pysal as ps
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\...\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\pysal\__init__.py", line 108, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\....\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\pysal\examples\__init__.py", line 8, in <module>
StopIteration [6600]无法执行脚本MCC_SLD_prep
先前在论坛和Google上进行的搜索显示,添加TKinter和DialogFile有帮助(第二层导入),因此我尝试将它们包括在spec文件中并运行pyinstaller仍不能解决问题。
有人可以提出一些想法吗?
我的pyinstaller批处理文件如下:
echo Preparing new file
pyinstaller --clean MCC_SLD_prep.exe
pause
REM --- PASS 2 and on
REM pyinstaller MCC_SLD_prep.spec
REM --- PASS 1, single file with icon, produce output in DIST
pyinstaller -F -i ABC.ico "..\src\MCC_SLD_prep.py"
pause
echo Ready to run