Python installation MySQL-python_MySQL

Source: Internet
Author: User
Install MySQL in python-python

1. first download mysql for python,: http://sourceforge.net/projects/mysql-python/

2. decompress the package, enter the directory, and then execute:

python setup.py buildpython setup.py install


Run: During build, EnvironmentError: mysql_config not found may be reported;

At this time, run sudo apt-get install libmysqld-dev first, and then find/-name mysql_config in/usr/bin /.

Then modify the site. cfg file under the MySQL-python-1.2.4b4 directory to remove the comment of mysql_config = XXX, and change it to mysql_config =/usr/bin/mysql_config (take the directory on the machine where the mysql_config file is located as the standard)

3. execute python setup. py build and python setup install;

Here, the second error may be reported: _ mysql. c: 29: 20: fatal error: Python. h:

The solution is to install python-dev: sudo apt-get install python-dev

4. okay. finally, execute python setup. py build and python setup install. everything is done.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.