如何在Python 2.6的Linux系统上通过pip/virtualenv为Python 2.5安装MySQL-python?

Ror*_*ory 1 python pip virtualenv mysql-python

我正在尝试为Django项目建立一个virtualenv.它需要MySQL-python.我正在尝试复制使用Python 2.5的生产环境.我的Ubuntu桌面有Python 2.5.我可以安装Python 2.5 virtualenv virtualenv --python=/usr/bin/python2.5 ....但是,当我尝试时pip install MySQL-python,我得到这个输出:

$ pip install MySQL-python
Downloading/unpacking MySQL-python
  Running setup.py egg_info for package MySQL-python
    warning: no files found matching 'MANIFEST'
    warning: no files found matching 'ChangeLog'
    warning: no files found matching 'GPL'
Installing collected packages: MySQL-python
  Running setup.py install for MySQL-python
    building '_mysql' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/usr/include/python2.5 -c _mysql.c -o build/temp.linux-i686-2.5/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -DUNIV_LINUX -DUNIV_LINUX
    In file included from _mysql.c:29:
    pymemcompat.h:10: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'gcc' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)

我已经安装了python-devUbuntu deb软件包,但这适用于Python 2.6.

我怎么能MySQL-python安装?

ada*_*dam 5

我在Ubuntu盒子上遇到了同样的问题.在安装MySQL-python之前pip,我需要使用以下命令从源代码编译模块和依赖项:

sudo apt-get build-dep python-mysqldb
Run Code Online (Sandbox Code Playgroud)

看到这篇文章 - http://theviceprogrammer.com/?p=238