Saqib Ali
Saqib Ali

Reputation: 12585

Why is import of msql-connector failing even though it was successfully installed?

I'm trying to install python-myconnector using the instructions provided here.

The installation succeeds:

(my_virtual_env)[my.username@my-machine ~]$ pip install mysql-connector
...
Successfully installed mysql-connector

However, then when I try to use it, importing the mysql.connector module fails. What?? Why???

(my_virtual_env)[my.username@my-machine ~]$ python
Python 2.7.12 (default, Sep  1 2016, 22:14:00)


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

Here is the full log of the installation and usage.

Upvotes: 0

Views: 74

Answers (1)

aprasanth
aprasanth

Reputation: 1099

pip install mysql-connector-python

This worked for me in python 2.7.12 venv.

Also you can see a discussion on this here.

Upvotes: 1

Related Questions