Python installation MySQLdb module

Source: Internet
Author: User

Take Ubuntu under installation as an example:

: https://pypi.python.org/pypi/MySQL-python/

After decompression, go directly to the unzip directory to run the installation command.

Install
View Code

If successful, the MYSQLDB module can be used successfully.

However, the following problems generally occur:

1) importerror:no module named Setuptools

Solution:

wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz tar zxvf setuptools-0. 6c11. Tar . GZ CD setuptools-0Install
View Code

The above commands are best performed with root privileges, or an error will occur.

2) Environmenterror:mysql_config not found

Solution:

Install libmysqlclient-devupdatedbLocate mysql_config
View Code

The role of the locate Mysql_config is to locate the Mysql_config file location, which is/usr/bin/mysql_config by default.

MySQLdb source to find the setup_posix.py file, the file Mysql_config.path value changed to:/usr/bin/mysql_config, and then you can install the


3) Error:setup script exited with Error:command ' GCC ' failed with exit status 1

Solution:

Install Python-dev
View Code

Python installation MySQLdb module

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.