1.首先安装mysql
sudo apt-get install mysql-server
2.然后安装libmysqld-dev和libmysqlclient-dev,否则在安装Mysqldb的时候会报找不到mysql_config文件
sudo apt-get install libmysqld-dev sudo apt-get install libmysqlclient-dev
3.安装完上述之后,到http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download下载最新的Mysqldb的tar包,解压
sudo python setup.py build sudo python setup.py install
sudo apt-get install python-setuptools
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/u01/mysql/include/mysql -I/usr/include/python2.6 -c _mysql.c -o build/temp.linux-i686-2.6/_mysql.o -DUNIV_LINUX In file included from _mysql.c:29: pymemcompat.h:10: fatal error: Python.h: 没有那个文件或目录 compilation terminated. error: command 'gcc' failed with exit status 1
则需要安装python-dev
sudo apt-get install python-dev
4.最后安装web.py
sudo apt-get install python-webpy