OSX anaconda虚拟环境py27,安装编译MySQLdb出现fatal error: limits.h: No such file or directory

来源:互联网 发布:山寨币 冷钱包源码 编辑:程序博客网 时间:2024/06/04 18:58
(py27) ➜  MySQL-python-1.2.3 python setup.py buildrunning buildrunning build_pycopying MySQLdb/release.py -> build/lib.macosx-10.7-x86_64-2.7/MySQLdbrunning build_extbuilding '_mysql' extensiongcc -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_64In 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 <limits.h>  /* 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,安装成功。


阅读全文
0 0
原创粉丝点击