ubuntu安装python-mysqldb
前期准备:
sudo apt-get install libmysqld-dev
sudo apt-get install libmysqlclient-dev
sudo apt-get install python-dev
sudo apt-get install python-setuptools
1.获取资源
wget http://nchc.dl.sourceforge.net/project/mysql-python/mysql-python-test/1.2.4b4/MySQL-python-1.2.4b4.tar.gz
2.解压
tar xzvf MySQL-python-1.2.4b4.tar.gz
3.安装
python setup.py install
错误一:
EnvironmentError: mysql_config not found
解决方法:
sudo apt-get install libmysqld-dev
sudo apt-get install libmysqlclient-dev
错误二:
error: command 'gcc' failed with exit status 1
解决方法:
sudo apt-get install libxml2
sudo apt-get install libxslt1.1
sudo apt-get install libxml2-dev
sudo apt-get install libxslt1-dev
sudo apt-get install python-libxml2
sudo apt-get install python-libxslt1
sudo apt-get install python-dev
sudo apt-get install python-setuptools