起因:
升级OS X从10.8到10.9,会发现在安装python的markupsafe模块时一直卡住。
当时的机器环境是:
OSX 10.9, XCode 4.6.2, Python 2.7.6, Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
界面一直停留在下面的情况
mbp:MarkupSafe-0.23 $ python setup.py install running install running bdist_egg running egg_info writing MarkupSafe.egg-info/PKG-INFO writing top-level names to MarkupSafe.egg-info/top_level.txt writing dependency_links to MarkupSafe.egg-info/dependency_links.txt reading manifest file 'MarkupSafe.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'MarkupSafe.egg-info/SOURCES.txt' installing library code to build/bdist.macosx-10.6-intel/egg running install_lib running build_py creating build creating build/lib.macosx-10.6-intel-2.7 creating build/lib.macosx-10.6-intel-2.7/markupsafe copying markupsafe/__init__.py -> build/lib.macosx-10.6-intel-2.7/markupsafe copying markupsafe/_compat.py -> build/lib.macosx-10.6-intel-2.7/markupsafe copying markupsafe/_constants.py -> build/lib.macosx-10.6-intel-2.7/markupsafe copying markupsafe/_native.py -> build/lib.macosx-10.6-intel-2.7/markupsafe copying markupsafe/tests.py -> build/lib.macosx-10.6-intel-2.7/markupsafe copying markupsafe/_speedups.c -> build/lib.macosx-10.6-intel-2.7/markupsafe running build_ext building 'markupsafe._speedups' extension creating build/temp.macosx-10.6-intel-2.7 creating build/temp.macosx-10.6-intel-2.7/markupsafe /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c markupsafe/_speedups.c -o build/temp.macosx-10.6-intel-2.7/markupsafe/_speedups.o
解决办法:
sudo ARCHFLAGS="-arch x86_64" CFLAGS=-Wunused-command-line-argument-hard-error-in-future pip install markupsafe
升级OSX到10.9后,又升级了XCode Command Line,造成clang的编译错误级别提升了,原来的警告都无法通过编译了。这个真坑爹!
结论:
在安装lxml和psycopg2等模块时也会有同样的情况发生,所以,在遇到这种情况可以参考解决。
当然,如果升级XCode到5.1+之后似乎就没有这个问题了。
引用(这几个链接帮了我大忙):
https://github.com/mitsuhiko/markupsafe/issues/27
http://robert.io/osx-mavericks-markupsafe-hanging
http://stackoverflow.com/questions/19798861/simplejson-on-mac-os-x-10-9-mavericks
http://stackoverflow.com/questions/22313407/clang-error-unknown-argument-mno-fused-madd-python-package-installation-fa/22322645#22322645
python安装markupsafe模块时卡死的解决办法,布布扣,bubuko.com
原文地址:http://blog.csdn.net/aqua_aqua/article/details/27703919