jted95
jted95

Reputation: 1144

Python: ImportError no module named mysql.connector

I just created an exe from python script and when I tried to run it, it did not show up.

Then, I tried to run it from cmd and I got ImportError below:

Traceback (most recent call last):
  File "tkintertest2.py", line 17, in <module>
  File "Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 
389, in load_module
  File "MySQL.py", line 1, in <module>
ImportError: No module named mysql.connector
Failed to execute script tkintertest2

How to solve this? I have installed mysql.connector using both pip install and conda install.

Upvotes: 2

Views: 6840

Answers (1)

NuclearPeon
NuclearPeon

Reputation: 6039

According to the pyinstaller docs here, pyinstaller is not finding the python module, so explicitly include it like so:

pyinstaller --hidden-import mysql.connector myscript.py

Upvotes: 3

Related Questions