原文链接
https://www.cnblogs.com/shenlaiyaoshi/p/8561052.html
问题描述
python的版本是
$ python --version
Python 2.7.12
报错代码如下
import mysql.connector
报错信息是
ImportError: No module named mysql.connector
开始时安装的驱动是,安装成功
$ pip install mysql-connector
但是如果要是安装 mysql-connector-python就会报错
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
所以现在使用的驱动是 mysql-connector 而不是 mysql-connector-python
求助有经验的朋友!!
问题已解决
步骤如下:
执行pip search mysql-connector | grep --color mysql-connector-python
输出信息是这样的
mysql-connector-python-rf (2.1.3) - MySQL driver written in Python
mysql-connector-python (2.0.4) - MySQL driver written in Python
使用pip install mysql-connector-python-rf==2.1.3
就可以了