Mac MYSQLDB module installation, can solve the

Source: Internet
Author: User

Reprint: http://blog.csdn.net/janronehoo/article/details/25207825

Essay: This article feel is a more comprehensive solution to the Mac MySQLdb module installation issues, especially reproduced.

Even the wrong is solved ... It bothers me half a month mysqldb, almost will give up

Python 2.7.3.

Mysql-python package, so whether you download or search in Pip, it should be search Mysql-python.

 

Download MySQLdb

Mysql-python-1.2.4b4.tar, unzip the download, and then execute the following command in Terminal Terminal:

new-host-3:~ ifantastic$ cd/users/ifantastic/downloads/mysql-python-1.2.4b4

NEW-HOST-3:MYSQL-PYTHON-1.2.4B4 ifantastic$ python setup.py install

Installing MYSQLDB with PIP

new-host-Install Mysql-python

Not found

$ easy_install Mysql-python--upgrade

Resolve Mysql_config not found error

Therefore, the solution to download the installation is: Locate the Site.cfg file in the Mysql-python installation package, open it, and locate the following:

# the path to mysql_config.< Span style= "margin:0px; padding:0px; Color: #008000; Line-height:1.5!important; " ># only use this if Mysql_ Config is isn't on your PATH, or you have some weird# setup that requires it.< Span style= "margin:0px; padding:0px; Color: #008000; Line-height:1.5!important; " ># Mysql_config =/usr/local /bin/mysql_config

Mysql_config =/usr/local/mysql/bin/mysql_config

$ python setup.py Install

There is no way to modify the Site.cfg file when using PIP installation, so you can resolve errors that cannot be found by modifying OS X's system environment variables.

Modify OS x environment variable: Open terminal, use VIM in terminal to open "~/.bash_profile", if no vim is installed, then show hidden file Open with text editor, the operation here is no longer described. In. Bash_profile, add the following:

  "/usr/local/mysql/bin:${ Path} "export pathexport dyld_library_path=/usr/local/mysql/lib/export versioner_python_prefer_64_bit=       

Among them versioner_python_prefer_64_bit and versioner_python_prefer_64_bit according to their own installation of MySQL to choose.

$ sudo ln-s/usr/local/mysql/bin/*/usr/bin

Resolve Reason:image not found error

After installing the Mysql-python package, let us import mysqldb, there is an error, the last line of error is written reason:image not found.

The workaround is to execute at the terminal:

$ sudo ln-s/usr/local/mysql/lib/libmysqlclient.18.dylib/usr/lib/libmysqlclient.18. dylib$ sudo ln-s/usr/local/ Mysql/lib/usr/local/mysql/lib/mysql


Error:

Clang:error: clang:note:this is a hard error (cannot is downgraded to a warning)

Verified Online: Http://www.tuicool.com/articles/zI7Vzu seems to be Mac OS Xcode from 5.1 to compiler rules for unknown parameter incoming as error We need to downgrade this error to warning using archflags so the final installation command should look like this:

sudo archflags=-wno-error=unused-command-line-argument-hard-error-in-future python setup.py build


Reference

Http://www.cnblogs.com/macro-cheng/archive/2011/10/25/mysql-001.html

Mac MYSQLDB module installation, can solve the

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.