gpt4 book ai didi

python - Pyinstaller导入报错没有模块命名路径

转载 作者:太空宇宙 更新时间:2023-11-03 12:05:00 24 4
gpt4 key购买 nike

我正在尝试在 python 中构建一个使用许多不同模块的程序。当我正常运行它时(从 cmd)一切正常,但是当我尝试创建可执行文件时不起作用。我尝试过使用 py2exe 和 pyinstaller,尝试用谷歌搜索这个问题几个小时,但没有任何效果。当我从 cmd 运行 exe 时,我得到了这个。我已经尝试手动导入必要的模块,但仍然没有用。有什么想法吗?

Traceback (most recent call last):
File "<string>", line 35, in <module>

File "site-packages\pyttsx\__init__.py", line 39, in init

File "site-packages\pyttsx\engine.py", line 45, in __init__

File "site-packages\pyttsx\driver.py", line 66, in __init__

File "site-packages\pyttsx\drivers\sapi5.py", line 37, in buildDriver

File "site-packages\pyttsx\drivers\sapi5.py", line 46, in __init__

File "site-packages\win32com\client\__init__.py", line 309, in WithEvents

File "site-packages\win32com\client\gencache.py", line 524, in EnsureModule

File "site-packages\win32com\client\gencache.py", line 291, in
MakeModuleForTypelib

File "site-packages\win32com\client\makepy.py", line 286, in
GenerateFromTypeLibSpec

File "site-packages\win32com\client\gencache.py", line 554, in
AddModuleToCache

File "site-packages\win32com\client\gencache.py", line 633, in _GetModule

File "c:\users\giorgo~1\appdata\local\temp\tmppddzle\gen_py\C866CA3A-32F7-
11D2-9602-00C04F8EE628x0x5x4.py", line 10, in <module>

import win32com.client.CLSIDToClass, pythoncom, pywintypes

File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
line 158, in load_module

return self._importer.load_module(fullname, self._fullname)


File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
line 389, in load_module

exec(bytecode, module.__dict__)

File "site-packages\pythoncom.py", line 2, in <module>

File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
line 158, in load_module

return self._importer.load_module(fullname, self._fullname)

File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
line 389, in load_module

exec(bytecode, module.__dict__)

File "site-packages\win32\lib\pywintypes.py", line 2, in <module>



File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
line 158, in load_module

return self._importer.load_module(fullname, self._fullname)

File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
line 389, in load_module

exec(bytecode, module.__dict__)

File "os.py", line 120, in <module>

ImportError: No module named path

alltogether returned -1

最佳答案

我最近遇到了类似的问题。 setuptools 19.3 中似乎存在错误。降级到 setuptools 19.2 为我修复了它。

要使用 pip 降级,只需键入:

pip install setuptools==19.2

我希望这对你有用。

关于python - Pyinstaller导入报错没有模块命名路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35254139/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com