pip在Mac OS X Mavericks(10.9)中提示stdio.h未找到错误 [英] pip raises stdio.h not found error on Mac OS X Mavericks (10.9)

查看:709
本文介绍了pip在Mac OS X Mavericks(10.9)中提示stdio.h未找到错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这一点上,我尝试过无数的解决方案,似乎没有任何工作。我试图安装mysql-python,但是这种情况发生在numpy和其他需要gcc的软件包上:

  building'_mysql 'extension 

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -g -O2 -DNDEBUG -g -O3 -Dversion_info = (1,2,5,'final',1)-D__version __ = 1.2.5 -I / usr / local / mysql / include -I / Library / Frameworks / Python.framework / Versions / 2.7 / include / python2.7 - c _mysql.c -o build / temp.macosx-10.6-intel-2.7 / _mysql.o -Os -g -fno-strict-aliasing -arch x86_64

从_mysql.c包含的文件中: 29:

/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:33:10:致命错误:找不到'stdio.h'文件

#include< stdio.h>

^

1生成的错误。

错误:命令'gcc-4.2'失败,退出状态1

要点:$ b​​
$ b

我已经安装了命令行工具

从/ usr / bin / gcc添加了符号链接到/ usb / bin / gcc-4.2

  gcc-4.2 --version 
配置:--prefix = / Library / Developer / CommandLineTools / usr --with-gxx-include-dir = / usr / include / c ++ / 4.2.1
Apple LLVM 5.1版(clang-503.0.40)(基于LLVM 3.4svn)
目标:x86_64-apple-darwin13.1.0
线程模型:posix

创建一个dummy c文件,编译成功,并运行它,所以gcc本身很好

  $ cat ac 
#include< ; stdio.h中>

main()
{
printf(hello\\\
);

$ b $ gcc-4.2 ac
ac:3:1:warning:类型说明符缺失,默认为'int'[-Wimplicit-int]
main ()
^ ~~~
1生成警告。

$ ./a.out
hello

好的方法,

  $ xcode-select -p 
/ Library / Developer / CommandLineTools

发生了什么?!



编辑 - 忘记包含python版本

  $ python 
Python 2.7.2(v2.7.2:8527427914a2,Jun 11 2011,15:22:34)
[GCC 4.2.1(Apple Inc. build 5666)(dot 3)] on darwin

编辑 - 激动人心的发展。设置这些变量会取得一些进展:
$ b $ pre $ code $ export $ CFLAGS = - arch i386 -arch x86_64
$ export FFLAGS = - m32 -m64
$ export LDFLAGS = - Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64
$ export CC = gcc-4.2
$ export CXX = g ++ -arch i386 -arch x86_64

然而,它仍然在
失败

  gcc-4.2 -bundle -undefined dynamic_lookup -isysroot /Developer/SDKs/MacOSX10.6.sdk -isysroot /Developer/SDKs/MacOSX10.6.sdk -g -Wall -undefined dynamic_lookup -bundle build / temp.macosx-10.6-intel-2.7 / _mysql.o -L -L / usr / local / mysql / lib -lmysqlclient_r -o build / lib.macosx-10.6-intel-2.7 / _mysql。 so -arch x86_64 
$ b ld:找不到-lSystem

的bng:错误:linker命令失败,退出代码1(使用-v查看调用)

错误:command'gcc-4.2'failed with exit status 1

我怀疑它是类似的错误也与命令有关LS。另外,它为什么使用/Developer/SDKs/MacOSX10.6.sdk? (原因是noob问题,我正在尝试从vim / unix迁移到pycharm / mac,到目前为止它还不是很好:()

解决方案正如上面提到的@wegry--

  brew install python 

确认与

  $ which python 
/ usr / local / homebrew / bin / python

完全消失。 numpy和mysql-python与pip!


I have tried countless solutions at this point and nothing seems to work. I'm trying to install mysql-python, but this happens with numpy and other packages requiring gcc as well:

building '_mysql' extension

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -g -O2 -DNDEBUG -g -O3 -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/mysql/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.6-intel-2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64

In file included from _mysql.c:29:

/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:33:10: fatal error: 'stdio.h' file not found

#include <stdio.h>

         ^

1 error generated.

error: command 'gcc-4.2' failed with exit status 1

To point:

I have installed command line tools

Added symlink from /usr/bin/gcc to /usr/bin/gcc-4.2

gcc-4.2 --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

Created a dummy c file, successfully compiled, and ran it, so gcc itself is fine

$ cat a.c
#include <stdio.h>

main()
{
    printf("hello\n");
}

$ gcc-4.2 a.c
a.c:3:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main()
^~~~
1 warning generated.

$ ./a.out
hello

And for good measure,

$ xcode-select -p
/Library/Developer/CommandLineTools

What is going on?!

EDIT - Forgot to include python version

$ python
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

EDIT - Exciting development. Setting these variables makes some progress:

$ export CFLAGS="-arch i386 -arch x86_64"
$ export FFLAGS="-m32 -m64"
$ export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64"
$ export CC=gcc-4.2
$ export CXX="g++ -arch i386 -arch x86_64"

However it fails again at

gcc-4.2 -bundle -undefined dynamic_lookup -isysroot /Developer/SDKs/MacOSX10.6.sdk -isysroot /Developer/SDKs/MacOSX10.6.sdk -g -Wall -undefined dynamic_lookup -bundle build/temp.macosx-10.6-intel-2.7/_mysql.o -L/usr/local/mysql/lib -lmysqlclient_r -o build/lib.macosx-10.6-intel-2.7/_mysql.so -arch x86_64

ld: library not found for -lSystem

clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: command 'gcc-4.2' failed with exit status 1

I suspect it's a similar error having to do with command tools. Also, why is it using "/Developer/SDKs/MacOSX10.6.sdk" ? (excuse the noob questions, I'm trying to migrate from vim/unix to pycharm/mac and it's not going very well so far :( )

解决方案

As @wegry mentioned above--

brew install python

confirming with

$ which python
/usr/local/homebrew/bin/python

just made this entirely go away. Successfully installed numpy and mysql-python with pip!

这篇关于pip在Mac OS X Mavericks(10.9)中提示stdio.h未找到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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