How to install MySQLdb in virtualenv on Debian
To install MySQL-Python with pip, you need some development header files of libmysqlclient.
If you try to install MySQL-Python with pip as follow:
pip install MySQL-Python
You will get this error, because of missing header files of libmysqlclient:
$ pip install MySQL-Python
Downloading/unpacking MySQL-Python
Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded
Running setup.py egg_info for package MySQL-Python
sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/home/maik/.virtualenvs/env1/build/MySQL-Python/setup.py", line 15, in <module>
metadata, options = get_config()
File "setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "setup_posix.py", line 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
Complete output from command python setup.py egg_info:
sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/home/maik/.virtualenvs/env1/build/MySQL-Python/setup.py", line 15, in <module>
metadata, options = get_config()
File "setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "setup_posix.py", line 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
This error can be solved by installing the libmysqlclient header files.
aptitude install libmysqlclient-dev
