Install Python's mysqldb module under Mac OS X

Source: Internet
Author: User

Resources:

Mac OS X Python installation mysqldb module http://www.codeif.com/post/1073/

MAC OSX uses Python to install modules for issues http://www.myexception.cn/operating-system/1616547.html

MySQL and Django are installed in Mac OS X, and when you access the MySQL database in Django, you are prompted with "Importerror:no module named MySQLdb", is because there is no MYSQLDB library installed for Python to connect to MySQL. In order to solve a series of problems, access to information, it took two hours to fix ...

download mysqldb at URL http://sourceforge.net/projects/mysql-python/ .

Straight then double-click Unzip, command line into the extracted directory, execute python setup.py build , appears " Environmenterror:mysql_config not found "Error

According to the prompt, you need to edit the path of the MySQL, first find the local MySQL path

Using VIM, open the setup_posix.py in the Mysql-python installation file to find“mysql_config.path = "mysql_config"”改为

Perform

Error occurred "Error:command ' CC ' failed with exit status 1"

Use Archflags to downgrade the error to warning

Installation Successful Mysql-python

When importing the MySQLdb module, there is an error:

To add a soft link:

Can eventually be used normally.

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.