Python installation of MySQL support module tutorial

Source: Internet
Author: User
Tags python mysql

This article will introduce you in detail to anyone who needs to know about installing the MySQL support module in Python.


After installing the MySQL support library for Python, I encountered a series of problems at one time. Fortunately, Google solved them all. Record it and forget it.

1. Download the Python MySQL support library

Address: http://sourceforge.net/projects/mysql-python/

2. decompress and compile

Python setup. py install

The first problem:

_ Mysql. c: 44: 23: error: my_config.h: No such file or directory

Solution: edit the setup_posix.py file and set mysql_config.path to the directory of your installed mysql, such as/usr/local/mysql/bin/mysql_config.

3. "import MySQLdb" in python. Problems:

ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory

Work und, edit the/etc/ld. so. conf. d/mysql-i386.conf File

Change to the correct mysql installation address, for example, usr/local/mysql/lib/mysql.

Save the disk and exit. Run ldconfig

4. Complete the work.

Related Article

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.