Install MySQL-python on Ubuntu

Source: Internet
Author: User

Install MySQL-python on Ubuntu

1. First, you need to determine whether the Ubuntu update source can be used. The source of Ubuntu 14.04 tested in this article has not been tried in earlier versions of Ubuntu. After all, labor is not a tester.

For security, cp/etc/apt/source. list/etc/apt/source. list. bak

The following is the source of Ubuntu 14.04. (find the source of other versions by yourself) write the following content to/etc/apt/source. list.

Deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
Deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
Deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
Deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
Deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
The deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
Deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
Deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
The deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
The deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

2. sudo apt-get update

3. sudo apt-get install mysql-python

An error is reported:

Sh: mysql_config: not found

Traceback (most recent call last ):

File "setup. py", line 15, in <module>

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

4. The specific cause is that the mysql_config file cannot be found under/usr/bin.

The solution for online query is generally that you do not have libmysqld-dev or libmysqlclient-dev, but you can find that all of them exist.

5. First, an important python-dev is generally not installed, so sudo apt-get install python-dev is required.

Continue to install mysql-python.

6. reinstall libmysqlclient-dev,

The miracle finally appeared:

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.