我经历了其他类似的问题,但那里提到的东西都没有达到我的目的。我的操作系统是 ubuntu 11.04,我首先创建了一个虚拟环境:
virtualenv mysite
完成后,我安装了 django
pip install django==1.3
安装 django 后我尝试为 python 安装 mysql 接口:
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: 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
我进一步尝试:
python -c "import MySQLdb"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named MySQLdb
请帮忙,谢谢。