Я стикався з подібною проблемою. Мої дані про середовище - Python 2.7.11 pip 9.0.1 CentOS, випуск 5.11 (Final)
Помилка інтерпретатора python -
>>> import mysql.connector
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named mysql.connector
>>>
Використовуйте pip для пошуку доступного модуля -
$ pip search mysql-connector | grep
mysql-connector-python-rf (2.2.2) - MySQL driver written in Python
mysql-connector-python (2.0.4) - MySQL driver written in Python
Встановіть mysql-connector-python-rf -
$ pip install mysql-connector-python-rf
Перевірити
$ python
Python 2.7.11 (default, Apr 26 2016, 13:18:56)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mysql.connector
>>>
Дякую =)
Для python3 та пізніших версій використовуйте наступну команду: $ pip3 встановіть mysql-connector-python-rf