sql >> Base de Datos >  >> RDS >> Mysql

Python:ModuleNotFoundError:Sin nombre de módulo 'mysql'

Use pip para buscar el módulo disponible

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

Para python3 y versiones posteriores, use el siguiente comando:$ pip3 install mysql-connector-python-rf