virtualenv, mysql-python, pip: anyone know how? [duplicate] virtualenv, mysql-python, pip: anyone know how? [duplicate] mysql mysql

virtualenv, mysql-python, pip: anyone know how? [duplicate]


I'm also trying to setup MySQL bindings in a virtualenv. All I had to do was install the package that contains mysql_config. On Ubuntu it's called libmysqlclient-dev.

After that I was able to do a (virtualenv'd) python setup.py build and python setup.py install.


In OS X I had used Macports to install my MySQL, which made the mysql_config file be called mysql_config5.

So I did:sudo ln -s mysql_config5 /opt/local/bin/mysql_config

And then ran pip install MySQL-python from a virtualenv and all was fine.


You may not have mysql_config at all if you don't have the appropriate mysqlclient-dev OS package installed.

Personally, for packages that require extensive C compilation, I prefer to install OS-packaged versions, as I've had fewer problems that way. It's easier to install the OS-packaged version of mysql-python on all my servers than it is to install the compilation dependencies.

Fortunately in my experience those packages also tend to be very stable (mysql-python, PIL, lxml, etc), so I don't need to version-pin them per-project.

It does, however, prevent me from using virtualenv --no-site-packages, which is a little annoying.