Install mysql for python in virtual environment

I went through other similar questions, but not one of the things mentioned there served my purpose. My OS is ubuntu 11.04. First I created a virtual environment:

virtualenv mysite 

Once this was done, I installed django

 pip install django==1.3 

post django installation I tried installing the mysql interface for python:

 pip install MySQL-python 

this gave me an error:

 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: mysql_config: not found Traceback (most recent call last): File "<string>", line 14, in <module> File "/home/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 

I still tried:

 python -c "import MySQLdb" Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named MySQLdb 

Please help, thanks.

+4
source share

Source: https://habr.com/ru/post/1391082/


All Articles