MAC OSX installs MySQL module problem with Python

Source: Internet
Author: User

System environment: MAC OSX 10.9.2
Python version: 2.7.5
The new beginning of the RMBP, with the Python environment, but put it into the production environment, there are various problems, first of all, the most deadly, is the installation module problems, resulting in the development has not been normal, the following is my installation of the Python module, the appearance and resolution, summarized as follows, Hope to be helpful to the later (take Mysql-python example, install PIL also encountered the same problem):
(1) Whether using the Easy_install installation module or downloading the installation package, the sudo python setup.py build installation will appear:
******
Error:command ' CC ' failed with exit status 1
Clang:error:unknown argument: '-mno-fused-madd ' [-wunused-command-line-argument-hard-error-in-future]
Clang:note:this'll be a hard error (cannot is downgraded to a warning) in the future
Error:command ' CC ' failed with exit status 1
After a series of searches: Http://www.tuicool.com/articles/zI7Vzu, seemingly mac The OS Xcode from 5.1 to the compiler specifies that for an unknown parameter incoming to be treated as error, we need to downgrade the 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 easy_install MySQL-python
So, the problem is solved, successfully installed on the Mysql-python
(2) Although the installation of Mysql-python, in the code development process, run the code, the problem arises again:
******
Import MySQLdb
File "build/bdist.macosx-10.9-intel/egg/mysqldb/__init__.py", line A, in <module>
File "build/bdist.macosx-10.9-intel/egg/_mysql.py", line 7, <module>
File "build/bdist.macosx-10.9-intel/egg/_mysql.py", line 6, in __bootstrap__
Importerror:dlopen (/users/kris/.python-eggs/mysql_python-1.2.5-py2.7-macosx-10.9-intel.egg-tmp/_mysql.so, 2): Library not Loaded:libmysqlclient.18.dylib
Referenced from:/users/kris/.python-eggs/mysql_python-1.2.5-py2.7-macosx-10.9-intel.egg-tmp/_mysql.so
Reason:image not found
After looking, I added two symbolic links (soft links):
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
Run the program again and the problem is resolved.

MAC OSX installs MySQL module problem with Python

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.