Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

ImportError:Nenhum módulo chamado mysql.connector usando Python2


Eu estava enfrentando o problema semelhante. Detalhes do meu env -Python 2.7.11pip 9.0.1CentOS versão 5.11 (final)

Erro no interpretador python -
>>> import mysql.connector
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named mysql.connector
>>>

Use pip para pesquisar o módulo disponível -
 $ pip search mysql-connector | grep --color mysql-connector-python



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

Instale o mysql-connector-python-rf -
$ pip install mysql-connector-python-rf

Verificar
$ 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
>>>