Python installation MySQLdb

Source: Internet
Author: User

Recently began to learn Python, in the installation of MYSQLDB encountered problems, card for a long time, decided to write down to deepen the memory, but also to the vast number of monkeys just learning Python also added a little reference value.

1. Enter python into the terminal import MYSQLDB if there is an error: Importerror:no module name MYSQLDB indicates no installation mysqldb

2. Install mysqldb access Https://pypi.python.org/pypi/MySQL-python to download the appropriate installation package for you.

3. Use the terminal CD to enter the folder, call the command $ python setup.py install, if into error: Environmenterror:mysql_config not found. First find the location of the Mysql_config,

In the terminal call $ locate mysql_config, (the landlord's location is/usr/local/bin/mysql_config) and then locate the setup_posix.py file under the Mysql-python resource file: Mysql_ in the file Config.path change its value to:/usr/local/bin/mysql_config (the location of your mysql_config),

4. Call $ python setup.py install ,成功了!!!

5.$ Python

$ import mysqldb done.

Python installation MySQLdb

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.