1.首先安裝mysqlpython
sudo apt-get install mysql-server
2.而後安裝libmysqld-dev和libmysqlclient-dev,不然在安裝Mysqldb的時候會報找不到mysql_config文件mysql
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包,解壓linux
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-devweb
sudo apt-get install python-dev
4.最後安裝web.pysql
sudo apt-get install python-webpy