gpt4 book ai didi

python - 导入错误: No module named pywinauto

转载 作者:行者123 更新时间:2023-12-01 09:20:06 26 4
gpt4 key购买 nike

我在 Windows 10 计算机上使用 python 2.7,并构建了一个需要打包成 exe 的应用程序。我尝试使用 py2exe 并收到错误。不幸的是,我使用的是工作笔记本电脑,他们只允许 py2exe,并且我已经尝试了堆栈溢出的每个选项。下面是我的 setup.py 文件。我也尝试过删除鸡蛋,但这也不起作用。

File "setup.py", line 10, in <module>
"includes": ["pywinauto"]
File "C:\Users\dcarlo\AppData\Local\Continuum\anaconda2\lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "C:\Users\dcarlo\AppData\Local\Continuum\anaconda2\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Users\dcarlo\AppData\Local\Continuum\anaconda2\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Users\dcarlo\AppData\Local\Continuum\anaconda2\lib\site-packages\py2exe\build_exe.py", line 243, in run
self._run()
File "C:\Users\dcarlo\AppData\Local\Continuum\anaconda2\lib\site-packages\py2exe\build_exe.py", line 296, in _run
self.find_needed_modules(mf, required_files, required_modules)
File "C:\Users\dcarlo\AppData\Local\Continuum\anaconda2\lib\site-packages\py2exe\build_exe.py", line 1297, in find_needed_modules
mf.import_hook(mod)
File "C:\Users\dcarlo\AppData\Local\Continuum\anaconda2\lib\site-packages\py2exe\mf.py", line 719, in import_hook
return Base.import_hook(self,name,caller,fromlist,level)
File "C:\Users\dcarlo\AppData\Local\Continuum\anaconda2\lib\site-packages\py2exe\mf.py", line 136, in import_hook
q, tail = self.find_head_package(parent, name)
File "C:\Users\dcarlo\AppData\Local\Continuum\anaconda2\lib\site-packages\py2exe\mf.py", line 204, in find_head_package
raise ImportError, "No module named " + qname
ImportError: No module named pywinauto
<小时/>
from distutils.core import setup
import pywinauto
import py2exe

setup(console=['plugwalk.py'],
options=
{
"py2exe":
{
"includes": ["pywinauto"]
}
}

最佳答案

这是由存储在站点包的子文件夹中的库引起的。只需将文件夹移动到主目录即可解决问题。

关于python - 导入错误: No module named pywinauto,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50861398/

26 4 0