Record pyinnstaller package file execution error modulenotfoundererror: no module named ‘cmath’ solution

Problem description

After packaging Python scripts with pyinnstaller, the executable file reported an error modulenotfoundererror: no module named ‘cmath’. However, I did not use cmath. After checking, I found that cmath was implicitly imported by default after panda version 1.2 (there is a description link here), but pyinnstaller did not check that cmath needs to be executed in the scripts, So it’s not packaged into an executable.


    similar to the errors caused by the inclusion of pandas or other libraries mentioned above, you can try to change the version of the corresponding library and modify the packaged. Spec configuration file (such as modification method). If not many dependencies are missing, this simple method is recommended to display the package with import error prompt in your own script

Read More: