简体   繁体   中英

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

I'm having a hard time converting my python code to an exe. After I use pyinstaller to convert my code to an exe, it gives me an error that its missing an import when I run it. Here's the full log:

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.

The name of the file I'm trying to convert is new.py which relies on pandas which apparently can't find a module called cmath. How do I fix this? Is there anyway for me to build an exe?

Add --hidden-import cmath to the pyinstaller run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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