我安装了PIP mysql的连接器,所以现在我有:即使我安装了Python,Python也不会识别mysql.connector?
$ pip install mysql-connector
Requirement already satisfied: mysql-connector in /usr/local/lib/python2.7/dist-packages
我也试过:
$ pip install mysql-connector-python-rf
Requirement already satisfied: mysql-connector-python-rf in /usr/local/lib/python2.7/dist-packages
现在在我的测试文件我只是有:
import mysql.connector
from mysql.connector import errorcode
但是,当我运行这个我得到:
$ python mysqlTest.py
Traceback (most recent call last):
File "mysqlTest.py", line 1, in <module>
import mysql.connector
File "/home/user/mysql.py", line 1, in <module>
ImportError: No module named connector
我在Ubuntu上运行,只是为了验证,这里是我的Python版本:
$ python --version
Python 2.7.12
任何想法?
还包括mysql连接器版本。 – MYGz