在Ubuntu 10.04上安装Mysql-python出错

下载了MySQL-python-1.2.3.tar.gz,用sudo python setup.py install 先后遇到两个错误:

1. EnvironmentError: mysql_config not found

Solution:  安装libmysqld-dev包。

2. 

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.7 -c _mysql.c -o build/temp.linux-i686-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -DUNIV_LINUX -DUNIV_LINUX
In file included from _mysql.c:29:0:
pymemcompat.h:10:20: fatal error: Python.h: No such file or directory

Solution: 安装python-dev包。

 

参考链接:

http://snippets.aktagon.com/snippets/211-How-to-install-and-use-the-mysql-python-library

posted @ 2011-11-03 19:26  Objdump  阅读(1331)  评论(0编辑  收藏  举报