Mysqldb和webpy的安裝

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

修改site.cfg中的mysql_config的配置地址,通常上述裝完後的默認地址爲/usr/bin/mysql_config
運行下列命令便可
sudo python setup.py build
sudo python setup.py install
若是報錯: ImportError: No module named setuptools,則須要安裝 setuptools
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
相關文章
相關標籤/搜索