致命错误:#include< stdio.h>在"pip install mysql-python"之后生成命令 [英] Fatal error: #include <stdio.h> generated after "pip install mysql-python" command

查看:122
本文介绍了致命错误:#include< stdio.h>在"pip install mysql-python"之后生成命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就像很多人一样,我在让mysql和python一起工作时遇到问题.我的规格是:

Like many people, I am having issues getting mysql and python to work together. My specs are:

OSX10.9.2 Anaconda 1.9.1和python 2.7.2,尽管似乎包含2.5和2.6 MySQL 5.6.16

OSX10.9.2 Anaconda 1.9.1 with python 2.7.2, although 2.5 and 2.6 appear to be included MySQL 5.6.16

我编写了一个python脚本,尝试导入MySQLdb,或者先导入PyMySQL,然后再导入MySQLdb,

I have written a python script where I try to import MySQLdb, or PyMySQL then MySQLdb, neither works.

我阅读了堆栈溢出时的许多线程,结果我最终尝试了

I read many of the threads on stack overflow, and as a result I eventually tried

$ export CFLAGS=-Qunused-arguments
$ export CPPFLAGS=-Qunused-arguments
$ pip install mysql-python

结果如下.在输出的底部可以看到致命错误.

The results are below. A fatal error was issued, as can be seen at the bottom of the output.

下载/解压缩mysql-python 正在下载MySQL-python-1.2.5.zip(108kB):已下载108kB 运行setup.py(路径:/private/var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip_build_vincent/mysql-python/setup.py)egg_info软件包mysql-python

Downloading/unpacking mysql-python Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded Running setup.py (path:/private/var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip_build_vincent/mysql-python/setup.py) egg_info for package mysql-python

安装收集的软件包:mysql-python 运行用于mysql-python的setup.py install 建立'_mysql'扩展 /usr/bin/clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -Dversion_info =(1,2,5,'final',1)-D_ version _ = 1.2.5 -I/usr/local/mysql/include -I/Users/vincentlaufer/anaconda/include/python2.7 -c _mysql.c -o build/temp.macosx-10.5-x86_64- 2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64 在_mysql.c:29包含的文件中: /Users/vincent/anaconda/include/python2.7/Python.h:33:10:致命错误:找不到"stdio.h"文件 #包括 ^ 产生1个错误. 错误:命令"/usr/bin/clang"失败,退出状态为1 命令/Users/vincentlaufer/anaconda/bin/python -c"import setuptools,tokenize; file ='/private/var/folders/lx/h7jq_qx92_j0n7plsjmr6wl4wlg0000/p/T/pip_build_vincent/mysql-python的完整输出/setup.py';exec(compile(getattr(tokenize,'open',open)( file ).read().replace('\ r \ n','\ n'), 文件,"exec"))"安装--record/var/folders/lx/h7jq_qx92_j0n7plsjmr6wl4wlg0000/p/T/pip-6aqGYj-record/install-record.txt --single-version-external-managed -编译: 运行安装

Installing collected packages: mysql-python Running setup.py install for mysql-python building '_mysql' extension /usr/bin/clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -Dversion_info=(1,2,5,'final',1) -D_version_=1.2.5 -I/usr/local/mysql/include -I/Users/vincentlaufer/anaconda/include/python2.7 -c _mysql.c -o build/temp.macosx-10.5-x86_64-2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64 In file included from _mysql.c:29: /Users/vincent/anaconda/include/python2.7/Python.h:33:10: fatal error: 'stdio.h' file not found #include ^ 1 error generated. error: command '/usr/bin/clang' failed with exit status 1 Complete output from command /Users/vincentlaufer/anaconda/bin/python -c "import setuptools, tokenize;file='/private/var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip_build_vincent/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip-6aqGYj-record/install-record.txt --single-version-externally-managed --compile: running install

正在运行构建

运行build_py

running build_py

创建版本

创建build/lib.macosx-10.5-x86_64-2.7

creating build/lib.macosx-10.5-x86_64-2.7

复制_mysql_exceptions.py-> build/lib.macosx-10.5-x86_64-2.7

copying _mysql_exceptions.py -> build/lib.macosx-10.5-x86_64-2.7

创建build/lib.macosx-10.5-x86_64-2.7/MySQLdb

creating build/lib.macosx-10.5-x86_64-2.7/MySQLdb

复制MySQLdb/ init .py-> build/lib.macosx-10.5-x86_64-2.7/MySQLdb

copying MySQLdb/init.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb

复制MySQLdb/converters.py-> build/lib.macosx-10.5-x86_64-2.7/MySQLdb

copying MySQLdb/converters.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb

复制MySQLdb/connections.py-> build/lib.macosx-10.5-x86_64-2.7/MySQLdb

copying MySQLdb/connections.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb

复制MySQLdb/cursors.py-> build/lib.macosx-10.5-x86_64-2.7/MySQLdb

copying MySQLdb/cursors.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb

复制MySQLdb/release.py-> build/lib.macosx-10.5-x86_64-2.7/MySQLdb

copying MySQLdb/release.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb

复制MySQLdb/times.py-> build/lib.macosx-10.5-x86_64-2.7/MySQLdb

copying MySQLdb/times.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb

创建build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

creating build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

复制MySQLdb/constants/ init .py-> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/init.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

复制MySQLdb/constants/CR.py-> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/CR.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

复制MySQLdb/constants/FIELD_TYPE.py-> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

复制MySQLdb/constants/ER.py-> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/ER.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

复制MySQLdb/constants/FLAG.py-> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

复制MySQLdb/constants/REFRESH.py-> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

复制MySQLdb/constants/CLIENT.py-> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants

运行build_ext

running build_ext

建立'_mysql'扩展名

building '_mysql' extension

创建build/temp.macosx-10.5-x86_64-2.7

creating build/temp.macosx-10.5-x86_64-2.7

/usr/bin/clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -Dversion_info =(1,2,5,'final',1)-D_ 版本 _ = 1.2.5 -I/usr/local/mysql/include -I/Users/vincent/anaconda/include/python2.7 -c _mysql.c -o build/temp.macosx-10.5 -x86_64-2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64

/usr/bin/clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -Dversion_info=(1,2,5,'final',1) -D_version_=1.2.5 -I/usr/local/mysql/include -I/Users/vincent/anaconda/include/python2.7 -c _mysql.c -o build/temp.macosx-10.5-x86_64-2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64

在_mysql.c:29包含的文件中: /Users/vincent/anaconda/include/python2.7/Python.h:33:10:致命错误:找不到"stdio.h"文件

In file included from _mysql.c:29: /Users/vincent/anaconda/include/python2.7/Python.h:33:10: fatal error: 'stdio.h' file not found

     ^

产生了1个错误.

错误:命令'/usr/bin/clang'失败,退出状态为1

error: command '/usr/bin/clang' failed with exit status 1

清理中... 命令/Users/vincent/anaconda/bin/python -c导入setuptools,标记化; 文件 ='/private/var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip_build_vincent/mysql-python/setup. py'; exec(compile(getattr(tokenize,'open',open)(文件).read().replace('\ r \ n','\ n'),文件,"exec"))"安装--record/var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip-6aqGYj-record/install-record.txt --single-version-externally-managed --compile在/private/var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip_build_vincent/mysql-python中失败,错误代码为1 在/Users/vincentlaufer/.pip/pip.log

Cleaning up... Command /Users/vincent/anaconda/bin/python -c "import setuptools, tokenize;file='/private/var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip_build_vincent/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip-6aqGYj-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip_build_vincent/mysql-python Storing debug log for failure in /Users/vincentlaufer/.pip/pip.log

我要感谢所有人提供的许多答案,这些答案已经使我走到了这一步,而且还要询问是否有人知道如何解决此问题.谢谢!!

I would like to thank everyone for the many answers provided that got me this far already, but also to ask if anyone knows how to solve this issue. Thank you!!

推荐答案

包含以下行:

$ xcode-select --install 

解决此问题的方法如下: GCC致命错误:stdio.h:没有这样的文件或目录

solves this problem, as per: GCC fatal error: stdio.h: No such file or directory

这篇关于致命错误:#include< stdio.h>在"pip install mysql-python"之后生成命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆