我已经安装了py2exe。我正在尝试将脚本转换为.exe。这是我的设置脚本。
from distutils.core import setup
import py2exe
setup(console=['Script1.py'])
当我运行它时,我收到导入错误。回溯如下。
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
exec codeObject in __main__.__dict__
File "C:\Users\z010388-dev\Desktop\setup.py", line 2, in <module>
import py2exe
File "C:\Python27\lib\site-packages\py2exe\__init__.py", line 9, in <module>
patch_distutils()
File "C:\Python27\lib\site-packages\py2exe\patch_distutils.py", line 68, in patch_distutils
from . import distutils_buildexe
File "C:\Python27\lib\site-packages\py2exe\distutils_buildexe.py", line 91, in <module>
from . import runtime
File "C:\Python27\lib\site-packages\py2exe\runtime.py", line 3, in <module>
from .dllfinder import Scanner, pydll
File "C:\Python27\lib\site-packages\py2exe\dllfinder.py", line 5, in <module>
from . import _wapi
ImportError: cannot import name _wapi
我的设置脚本有什么问题吗?有什么问题?