加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python – Pyinstaller导入错误没有模块命名路径

发布时间:2020-12-20 13:09:55 所属栏目:Python 来源:网络整理
导读:我正在尝试在 python中构建一个程序,它使用了很多不同的模块.当我正常运行它(从cmd)一切正常,但是当我尝试创建一个可执行文件时不起作用.我已经尝试使用py2exe和pyinstaller,尝试谷歌搜索问题几个小时,但没有什么真正有效.当我从cmd运行exe时,我得到了这个.
我正在尝试在 python中构建一个程序,它使用了很多不同的模块.当我正常运行它(从cmd)一切正常,但是当我尝试创建一个可执行文件时不起作用.我已经尝试使用py2exe和pyinstaller,尝试谷歌搜索问题几个小时,但没有什么真正有效.当我从cmd运行exe时,我得到了这个.我试过手动导入必要的模块,但仍然没有工作.有任何想法吗?

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

File "site-packagespyttsx__init__.py",line 39,in init

  File "site-packagespyttsxengine.py",line 45,in __init__

  File "site-packagespyttsxdriver.py",line 66,in __init__

  File "site-packagespyttsxdriverssapi5.py",line 37,in buildDriver

  File "site-packagespyttsxdriverssapi5.py",line 46,in __init__

  File "site-packageswin32comclient__init__.py",line 309,in WithEvents

  File "site-packageswin32comclientgencache.py",line 524,in EnsureModule

  File "site-packageswin32comclientgencache.py",line 291,in 
MakeModuleForTypelib

  File "site-packageswin32comclientmakepy.py",line 286,in 
GenerateFromTypeLibSpec

  File "site-packageswin32comclientgencache.py",line 554,in 
AddModuleToCache

  File "site-packageswin32comclientgencache.py",line 633,in _GetModule

  File "c:usersgiorgo~1appdatalocaltemptmppddzlegen_pyC866CA3A-32F7-
11D2-9602-00C04F8EE628x0x5x4.py",line 10,in <module>

    import win32com.client.CLSIDToClass,pythoncom,pywintypes

  File "c:python27Libsite-packagesPyInstallerloaderpyimod03_importers.py",line 158,in load_module

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


  File "c:python27Libsite-packagesPyInstallerloaderpyimod03_importers.py",line 389,in load_module

    exec(bytecode,module.__dict__)

  File "site-packagespythoncom.py",line 2,in <module>

  File "c:python27Libsite-packagesPyInstallerloaderpyimod03_importers.py",self._fullname)

  File "c:python27Libsite-packagesPyInstallerloaderpyimod03_importers.py",module.__dict__)

  File "site-packageswin32libpywintypes.py",in <module>



  File "c:python27Libsite-packagesPyInstallerloaderpyimod03_importers.py",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

我希望这适合你.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读