Python / Pip C包PyProj无法使用GCC进行编译 [英] Python/Pip C package PyProj fails to compile with GCC

查看:534
本文介绍了Python / Pip C包PyProj无法使用GCC进行编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 PyProj =https://www.webfaction.com/ =nofollow noreferrer> WebFaction VM,通过 virtualenv & 点子。我收到编译错误。我使用这个命令:

  $ pip install pyproj 

$ b

有很多输出,终止于此:

  src / geodesic.c:在函数'InverseStart'中:

src / geodesic.c:1093:错误:ISO C90禁止混合声明和代码

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

-------------------------------------- -
命令/home/<user>/webapps/<webapp>/env/py34/bin/python3.4 -cimport setuptools,tokenize; __ file __ ='/ tmp / pip-build- ow1vcsjk / pyproj / setup.py'; exec(compile(getattr(tokenize,'open',open)(__ file __)。read().exc('\r\\\
','\\\
'),__file__ ,'exec'))install --record /tmp/pip-cl2pbd20-record/install-record.txt --single-version-external-managed -compile --install-headers / home /< user> / webapps /< webapp> /env/py34/include/site/python3.4失败,错误代码为1 / tmp / pip-build-ow1vcsjk / pyproj

我不太确定从哪里开始。我从这个SO问题问题在于PyProj中C90的兼容性问题,我可能会针对C99编译。只是一个猜测。



如上所述,这是在具有shell访问权限的远程VM上。我的开发机器上有一个匹配的Virtualenv(Mac),编译时没有问题。但是,有不同的编译器:

Dev:

  $ gcc --version 
配置:--prefix = / Applications / Xcode.app /目录/ Developer / usr --with-gxx-include-dir = / usr / include / c ++ / 4.2.1
Apple LLVM 6.0版(clang-600.0.56)(基于LLVM 3.5svn)

VM:

  $ gcc --version 
gcc(GCC)4.4.7 20120313(Red Hat 4.4.7-11)

想法?

解决方案

问题在于VM上的GCC版本默认为ISO C90标准,但pyproj代码与此不兼容。要强制GCC使用C99,您需要相应地设置CFLAGS环境变量,请尝试

  export CFLAGS =' -  std = c99 '

然后再次运行 pip install pyproj 。我得到了与healpy相同的问题,这对我有用。


I'm trying to install PyProj on a WebFaction VM, via virtualenv & pip. I'm getting compile errors. I'm using this command:

$ pip install pyproj

There's a lot of output, terminating in this:

src/geodesic.c: In function ‘InverseStart’:

src/geodesic.c:1093: error: ISO C90 forbids mixed declarations and code

error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/home/<user>/webapps/<webapp>/env/py34/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-ow1vcsjk/pyproj/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-cl2pbd20-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/<user>/webapps/<webapp>/env/py34/include/site/python3.4" failed with error code 1 in /tmp/pip-build-ow1vcsjk/pyproj

I'm not quite sure where to start. I gather from this SO question the problem lies in compatibility for C90 in PyProj, and I might compile instead against C99. Just a guess.

As mentioned, this is on a remote VM with shell access. I have a matching Virtualenv on my dev machine (Mac), which compiles without issue. However, there are different compilers:

Dev:

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)

VM:

$ gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)

Ideas? Thanks in advance.

解决方案

The problem is that the version of GCC on your VM is defaulting to the ISO C90 standard but the pyproj code is incompatible with that. To force GCC to use C99 instead you need to set the CFLAGS environment variable accordingly, try

export CFLAGS='-std=c99'

then run pip install pyproj again. I get the same problem with healpy and this works for me.

这篇关于Python / Pip C包PyProj无法使用GCC进行编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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