Mac installation Python module encounters "Error:command ' CC ' failed with exit status 1" solution __python

Source: Internet
Author: User

Turn from: http://blog.csdn.net/yiliumu/article/details/22995899



System environment: MAC OS X 10.9.2

Python version: 2.7.5

The RMBP of the new beginning, with the Python environment, but put it into the production environment, there are a variety of problems, first and foremost, is the installation module problems, resulting in the normal development, the following is my in the installation of Python module, appeared and resolved, summarized as follows, Hope to help later (take Mysql-python example, install PIL also encountered the same problem):

(1) Whether you are using the Easy_install installation module or downloading the installation package, using the sudo python setup.py build installation, you will receive:

******

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 would 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 search: Http://www.tuicool.com/articles/zI7Vzu, looks like a Mac OS Xcode from 5.1 to the compiler to specify that for unknown parameters passed as error, we need to use Archflags to demote the error to warning, so the final installation command should be as follows:

sudo archflags=-wno-error=unused-command-line-argument-hard-error-in-future easy_install MySQL-python

In this way, the problem is solved, successfully installed on the Mysql-python

(2) Although installed on the Mysql-python, in the code development process, run the code, the problem arises:

******

Import MySQLdb

File "build/bdist.macosx-10.9-intel/egg/mysqldb/__init__.py", line, in <module>
File "build/bdist.macosx-10.9-intel/egg/_mysql.py", line 7, in <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 solved.

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.