How to install the Mysql support module in Python _mysql

Source: Internet
Author: User
Tags python mysql in python
Just install Python MySQL support library, a breath encountered a series of problems, fortunately, Google, are resolved. And the record, the memo.

1. Download Python's MySQL support library

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

2. Decompression and compilation

Python setup.py Install

First problem encountered:

_mysql.c:44:23:error:my_config.h:no such file or directory

Workaround, edit the setup_posix.py file, and set the Mysql_config.path to the MySQL directory you installed, such as/usr/local/mysql/bin/mysql_config

3. In Python "Import MySQLdb", encountered a problem:

Importerror:libmysqlclient_r.so.16:cannot open Shared object file:no such file or directory

Workaround, edit/etc/ld.so.conf.d/mysql-i386.conf file

Change to the correct MySQL installation address, such as mine: Usr/local/mysql/lib/mysql

After saving, exit, execute Ldconfig

4. Get it done, finish the call.
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.