[Solved] Python import module error: importerror: no module named mysql.connector

The version of Python is

$ python --version
Python 2.7.12

The error code is as follows


The error message is


The driver installed at the beginning is that the installation was successful

$ pipinstallmysql-connector

But if you install MySQL connector python, you will report an error

Collecting mysql-connector-python
  Could not find a version that satisfies the requirement mysql-connector-python (from versions: ) No matching distribution found for mysql-connector-python

So now the driver is MySQL connector instead of MySQL connector Python
ask for help from an experienced friend

The problem has been solved

The steps are as follows:

Execute PIP search MySQL connector | grep -- color MySQL connector Python

The output is like this

mysql-connector-python-rf (2.1.3)        - MySQL driver written in Python mysql-connector-python (2.0.4) - MySQL driver written in Python

Usepip install mysql-connector-python-rf==2.1.3 is ok

Similar Posts: