'Converting py file to exe: ModuleNotFoundError: No module named 'configparser'

I have a python program which I converted to an exe file using pyinstaller. The python version works fine however when I run the exe version, I get this error:

   ModuleNotFoundError: No module named 'configparser'
   [15800] Failed to execute script 'main' due to unhandled exception!
 

Now I have checked this answer and tried :

  • installing configParser
  • using sudo python3 -m pip install mysql-connector
  • pip install mysqlclient

and non solved the issue. What could I be doing wrong? and if it gets solved and I convert it to exe, would the packages work in the exe file?

Would Appreciate any insight.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source