繁体   English   中英

exe 构建后的 Pyinstaller 错误:ModuleNotFoundError: No module named 'cmath'

[英]Pyinstaller Error after exe built: ModuleNotFoundError: No module named 'cmath'

我很难将我的 python 代码转换为 exe。 在我使用 pyinstaller 将我的代码转换为 exe 后,它给了我一个错误,当我运行它时它缺少导入。 这是完整的日志:

Traceback (most recent call last):
  File "new.py", line 1, in <module>
  File "/Users/name/opt/anaconda3/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "nsepython/__init__.py", line 1, in <module>
  File "/Users/name/opt/anaconda3/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "nsepython/rahu.py", line 6, in <module>
  File "/Users/name/opt/anaconda3/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "pandas/__init__.py", line 179, in <module>
  File "/Users/name/opt/anaconda3/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "pandas/testing.py", line 5, in <module>
  File "/Users/name/opt/anaconda3/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "pandas/_testing.py", line 27, in <module>
  File "pandas/_libs/testing.pyx", line 1, in init pandas._libs.testing
ModuleNotFoundError: No module named 'cmath'
[74486] Failed to execute script new
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

我要转换的文件的名称是 new.py,它依赖于 pandas,显然找不到名为 cmath 的模块。 我该如何解决? 无论如何我可以构建一个exe吗?

--hidden-import cmath添加到 pyinstaller 运行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM