OSX anaconda仮想環境py 27、インストールコンパイルMySQLdb fatal error:limits.h: No such file or directory
(py27) ➜ MySQL-python-1.2.3 python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.7-x86_64-2.7/MySQLdb
running build_ext
building '_mysql' extension
gcc -fno-strict-aliasing -I/Users/kris/anaconda3/envs/py27/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql/include -I/Users/kris/anaconda3/envs/py27/include/python2.7 -c _mysql.c -o build/temp.macosx-10.7-x86_64-2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64
In file included from /Users/kris/anaconda3/envs/py27/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/syslimits.h:7:0,
from /Users/kris/anaconda3/envs/py27/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/limits.h:34,
from /Users/kris/anaconda3/envs/py27/include/python2.7/Python.h:19,
from pymemcompat.h:10,
from _mysql.c:29:
/Users/kris/anaconda3/envs/py27/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory
#include_next /* recurse down to the real one */
^
compilation terminated.
error: command 'gcc' failed with exit status
OSXにxcodeコマンドラインツールがインストールされていることを確認します.
xcode-select --install
ポップアップを受け入れるダイアログボックスを確認し、インストールを行います.That will install system headers into standard locations expected by tools like gcc, e.g.
/usr/include
. 再pip install MySQLdb、インストールに成功しました.