python安裝mysqldb

1.安裝setuptools-0.6c11python

wget --no-check-certificate  http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar zxf setuptools-0.6c11.tar.gz && cd setuptools-0.6c11
python setup.py build
python setup.py installmysql

2.安裝MySQL-python-1.2.3sql

wget http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download
tar zxf MySQL-python-1.2.3.tar.gz && cd MySQL-python-1.2.3
python setup.py build
python setup.py install
ide

若是在執行python setup.py build時,報EnvironmentError: mysql_config not found的話,先查找mysql_config的位置,使用find / -name mysql_config,個人是在/usr/local/mysql/bin/mysql_config,而後修改MySQL-python-1.2.3目錄下的site.cfg文件,去掉mysql_config=XXX這行的註釋,並改爲mysql_config=/usr/local/mysql/bin/mysql_config,以本身機器的爲準.ui

再執行下面命令就能夠了spa

python setup.py build
python setup.py install

.net

相關文章
相關標籤/搜索