Search code examples
python-2.7virtualenvmysql-pythoncentos6percona

Unable to get these to cooperate: mysql-python + virtualenv + percona + centos6


I've gone through many threads related to installing mysql-python in a virtualenv, including those specific to users of Percona. None have solved my problem thus far.

With Percona, it is normal to get a long error on pip install MySQL-python in the virtualenv that ultimately says EnvironmentError: mysql_config not found. One method to remedy this is yum install mysql-devel, which I've done. I can actually get mysql-python to install properly outside of the virtualenv via yum.

I'm getting the error in the virtualenv only - it uses Python 2.7.9, wheareas 2.6.6 is what comes with Centos.

Also, with MySQL-python installed via yum it will import to the OS's python interpreter, but will not import into the virtualenv's python interpreter.

To clarify, I only installed mysql-python via yum to see whether or not it would work that way. I would prefer it be by pip, in the environment only.

What am I missing here? As far as I'm aware it should work - considering it will work outside of virtualenv.


Solution

  • Found the solution! I think it was improper of my to install mysql-devel in the first place, so I went ahead and uninstalled it.

    Instead, I used a packaged supplied by Percona - Percona-Server-devel-55

    yum install Percona-Server-devel-55 and the problem is solved!