Solve the Problem of installing mysqldb using pip in centos

Source: Internet
Author: User

Solve the Problem of installing mysqldb using pip in centos

On the centos-6.4 pip install mysql-python, the error is as follows [sentry @ kjtest111 mysql-python] $ pip install mysql-python

Downloading/unpacking mysql-python

Running setup. py egg_info for package mysql-python

Sh:/usr/bin/mysql_config: No such file or directory

Traceback (most recent call last ):

File "<string>", line 16, in <module>

File "/tmp/pip-build-sentry/mysql-python/setup. py", line 18, in <module>

Metadata, options = get_config ()

File "setup_posix.py", line 43, in get_config

Libs = mysql_config ("libs_r ")

File "setup_posix.py", line 25, in mysql_config

Raise EnvironmentError ("% s not found" % (mysql_config.path ,))

EnvironmentError:/usr/bin/mysql_config not found

Complete output from command python setup. py egg_info:

Sh:/usr/bin/mysql_config: No such file or directory

Traceback (most recent call last ):

File "<string>", line 16, in <module>

File "/tmp/pip-build-sentry/mysql-python/setup. py", line 18, in <module>

Metadata, options = get_config ()

File "setup_posix.py", line 43, in get_config

Libs = mysql_config ("libs_r ")

File "setup_posix.py", line 25, in mysql_config

Raise EnvironmentError ("% s not found" % (mysql_config.path ,))

EnvironmentError: mysql_config not found

----------------------------------------

Working environment: centOS6.4

Solution: 1. the error message shows that mysql_config is missing. The mysql_config file in/usr/bin/does not exist. The online solution is apt-get install libmysqlclient-dev, however, apt-get is the network installation command of the Debian and Ubuntu series, and yum is the Redhat, Centos, and Fedora are the network installation commands. Then we find that mysql-devel should be installed on Centos.

2. yum install mysql-devel. if a conflict is found, the following error is returned:

--> Running transaction check

---> Package mysql-devel.x86_64. 1.69-1. el6_4 will be installed

--> Processing Dependency: mysql = 5.1.69-1. el6_4 for package: mysql-devel-5.1.69-1.el6_4.x86_64

--> Running transaction check

---> Package mysql. x86_64. 1.69-1. el6_4 will be installed

--> Processing Conflict: MySQL-client-5.5.30-1.el6.x86_64 conflicts mysql

--> Processing Conflict: MySQL-server-5.5.30-1.el6.x86_64 conflicts mysql

--> Processing Conflict: mysql-5.1.69-1.el6_4.x86_64 conflicts MySQL

--> Finished Dependency Resolution

Error: mysql conflicts with MySQL-devel-5.5.30-1.el6.x86_64

You cocould try using -- skip-broken to work around the problem

You cocould try running: rpm-Va -- nofiles -- nodigest

3. Run rpm-qa | grep mysql to check the mysql installation status.

Mysql-devel-5.5.16-1.el6_4.x86_64

Mysql-client-5.5.16-1.el6_4.x86_64

Mysql-server-5.5.16-1.el6_4.x86_64

4. Remove an existing installation package with rpm-e mysql-devel-5.5.16-1.el6_4.x86_64

5. Use yum install mysql-devel again to find a version conflict with mysql-server and mysql-client.

6. go online to find the same Version Download unzip-ivh MySQL-devel-5.5.16-1.linux2.6.x86_64.rpm Installation

7. After the installation is successful, go to the/usr/bin/directory and find that the mysql_config file is generated, and continue pip install mysql-python.

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.