在虚拟环境中为python安装mysql

时间:2012-01-15 08:50:13

标签: pip ubuntu-11.04 mysql-python django-database

我经历了其他类似的问题,但那里提到的所有东西都没有达到我的目的。我的操作系统是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

请帮助,谢谢。

0 个答案:

没有答案