Home > Database > Mysql Tutorial > python安装MySQL-python_MySQL

python安装MySQL-python_MySQL

WBOY
Release: 2016-06-01 13:10:43
Original
1437 people have browsed it

python

1、先下载 mysql for python,下载地址:http://sourceforge.net/projects/mysql-python/

2、解压,进入目录然后执行:

   

python setup.py buildpython setup.py install
Copy after login


这里在执行:build的时候可能就会报 EnvironmentError: mysql_config not found;

这个时候,先执行:sudo apt-get install libmysqld-dev,然后在执行  find / -name mysql_config 在/usr/bin/下发现了这个文件

然后修改MySQL-python-1.2.4b4目录下的site.cfg文件去掉mysql_config=XXX这行的注释,并改成mysql_config=/usr/bin/mysql_config(以mysql_config文件所在机器上的目录为准)

3、在执行python setup.py build和python setup install;

这里,就有可能会报第二个错误了:_mysql.c:29:20: fatal error: Python.h:

解决办法就是安装python-dev:sudo apt-get install python-dev

4、好啦,最后在执行一下python setup.py build和python setup install,一切搞定。


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template