Python install mysql-python simple notes (ubuntu environment)

Source: Internet
Author: User
This article mainly introduces how to install mysql-python in python, and the testing environment is ubuntu. it details the problems and solutions encountered during mysql-python installation, this document describes how to install mysql-python in python. We will share this with you for your reference. The details are as follows:

Operations in ubuntu

The pip tool is installed first.

sudo apt-get install python-pip

Then use

sudo pip install mysql-python

Install a third-party library. However, an error is reported.

sh: mysql_config: not foundTraceback (most recent call last): File "setup.py", line 15, in 
 
    metadata, options = get_config() File "/home/zhxia/apps/source/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config  libs = mysql_config("libs_r") File "/home/zhxia/apps/source/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config  raise EnvironmentError("%s not found" % (mysql_config.path,))EnvironmentError: mysql_config not found
 

The reason is that libmysqlclient-dev is not installed.

sudo apt-get install libmysqlclient-dev

Continue to install and find or report an error

Mysql. c: 29: 20: fatal error: Python. h: the file or directory does not exist. The Python header file cannot be found. isn't the python development kit installed in wheezy by default?

sudo dpkg -l | grep python-dev

No, but you still need to install it:

sudo apt-get install python-dev

MySQL-python can be compiled.

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.