我正在尝试使用 py2exe 将 python 脚本转换为独立的可执行文件。该脚本主要使用 arcpy 构建,带有 Tkinter GUI。
setup.py 脚本如下:
from distutils.core import setup
import py2exe
script = r"pathtoscript.py"
options = {'py2exe':{
"includes": ['arcpy', 'arcgisscripting'],
"packages": ['arcpy', 'arcgisscripting'],
"dll_excludes": ["mswsock.dll", "powrprof.dll"]
}}
setup(windows=[script], options=options)
运行时,setup.py 按预期创建 .exe,但是当我尝试运行可执行文件时,出现以下错误:
Traceback (most recent call last):
File "autolim.py", line 7, in <module>
File "arcpy\__init__.pyc", line 21, in <module>
File "arcpy\geoprocessing\__init__.pyc", line 14, in <module>
File "arcpy\geoprocessing\_base.pyc", line 14, in <module>
File "arcgisscripting.pyc", line 12, in <module>
File "arcgisscripting.pyc", line 10, in __load
ImportError: DLL load failed: The specified module could not be found.
我使用 python 2.7 和 arcgis 10.1 - 随时询问我是否忘记了任何有用的信息。
谁能告诉我我需要做什么才能使可执行文件正常工作?
非常感谢!