'ModuleNotFoundError: No module named 'mysql'
Trying to store values in sql using Python Cgi script, I have downloaded the Connector/Python for MySQL successfully. I used the following code in Python's shell to test my connection:
import mysql.connector
I received the following error message:
ModuleNotFoundError: No module named 'mysql'
when trying to import MySQL.connector.
Solution 1:[1]
Just try this command:
pip install mysql-connector-python-rf
then try your command again, it'll run correctly.
Solution 2:[2]
try below command
pip install mysql-connector
Solution 3:[3]
I had the same problem that was created by conflicting package names.
Try creating a fresh virtual environment, then running pip install mysql-connector-python.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Eslam Saber |
| Solution 2 | Kairat Koibagarov |
| Solution 3 | Gus Beringer |
