Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not get mysql-connector-python to install in virtualenv

Tags:

python

mysql

I'm using Amazon Linux AMI release 2013.09. I've install virtualenv and after activation then I run pip install mysql-connector-python, but when I run my app I get an error: ImportError: No module named mysql.connector. Has anyone else had trouble doing this? I can install it outside of virtualenv and my script runs without issues. Thanks in advance for any help!

like image 471
slim Avatar asked Feb 28 '14 16:02

slim


1 Answers

Several things. There is an inconsistency in package naming so you may want to do:

pip search mysql-connector 

to find out what it is called on your platform. I got two results mysql-connector-python and mysql-connector-repackaged.

so try this first:

pip install mysql-connector-python 

this may additionally give an error like this:

Some externally hosted files were ignored (use      --allow-external mysql-connector-python to allow). 

so finally this should do the job:

pip install mysql-connector-python --allow-external mysql-connector-python 
like image 156
Kinjal Dixit Avatar answered Sep 30 '22 17:09

Kinjal Dixit