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.