linux不支持uint64_t,python – 由于未知类型名称’uint64_t’,Cythonizing失败

这可能是一个新手问题.我无法cython化一个简单的helloworld.pyx教程脚本,而完全相同的代码适用于

linux:

print("hello world")

这是setup.py脚本:

from distutils.core import setup

from Cython.Build import cythonize

setup(ext_modules = cythonize('helloworld.pyx'))

但是我在运行python setup.py build_ext –inplace后得到了这个:

running build_ext

building 'helloworld' extension

creating build

creating build/temp.macosx-10.7-x86_64-3.6

gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/haotian/anaconda3/include -arch x86_64 -I/Users/haotian/anaconda3/include -arch x86_64 -I/Users/haotian/anaconda3/include/python3.6m -c helloworld.c -o build/temp.macosx-10.7-x86_64-3.6/helloworld.o

In file included from helloworld.c:16:

In file included from /Users/haotian/anaconda3/include/python3.6m/Python.h:34:

In file included from /usr/include/stdlib.h:65:

In file included from /usr/include/sys/wait.h:110:

/usr/include/sys/resource.h:196:2: error: unknown type name 'uint8_t'

uint8_t ri_uuid[16];

^

/usr/include/sys/resource.h:197:2: error: unknown type name 'uint64_t'

uint64_t ri_user_time;

^

/usr/include/sys/resource.h:198:2: error: unknown type name 'uint64_t'

uint64_t ri_system_time;

^

/usr/include/sys/resource.h:199:2: error: unknown type name 'uint64_t'

uint64_t ri_pkg_idle_wkups;

^

/usr/include/sys/resource.h:200:2: error: unknown type name 'uint64_t'

uint64_t ri_interrupt_wkups;

^

/usr/include/sys/resource.h:201:2: error: unknown type name 'uint64_t'

uint64_t ri_pageins;

^

/usr/include/sys/resource.h:202:2: error: unknown type name 'uint64_t'

uint64_t ri_wired_size;

^

/usr/include/sys/resource.h:203:2: error: unknown type name 'uint64_t'

uint64_t ri_resident_size;

^

/usr/include/sys/resource.h:204:2: error: unknown type name 'uint64_t'

uint64_t ri_phys_footprint;

^

/usr/include/sys/resource.h:205:2: error: unknown type name 'uint64_t'

uint64_t ri_proc_start_abstime;

^

/usr/include/sys/resource.h:206:2: error: unknown type name 'uint64_t'

uint64_t ri_proc_exit_abstime;

^

/usr/include/sys/resource.h:210:2: error: unknown type name 'uint8_t'

uint8_t ri_uuid[16];

^

/usr/include/sys/resource.h:211:2: error: unknown type name 'uint64_t'

uint64_t ri_user_time;

^

/usr/include/sys/resource.h:212:2: error: unknown type name 'uint64_t'

uint64_t ri_system_time;

^

/usr/include/sys/resource.h:213:2: error: unknown type name 'uint64_t'

uint64_t ri_pkg_idle_wkups;

^

/usr/include/sys/resource.h:214:2: error: unknown type name 'uint64_t'

uint64_t ri_interrupt_wkups;

^

/usr/include/sys/resource.h:215:2: error: unknown type name 'uint64_t'

uint64_t ri_pageins;

^

/usr/include/sys/resource.h:216:2: error: unknown type name 'uint64_t'

uint64_t ri_wired_size;

^

/usr/include/sys/resource.h:217:2: error: unknown type name 'uint64_t'

uint64_t ri_resident_size;

^

fatal error: too many errors emitted, stopping now [-ferror-limit=]

20 errors generated.

error: command 'gcc' failed with exit status 1

我使用的是MacOS 10.13.1,python 3.6.3,Cython 0.27.3和clang-900.0.38.

显然包含stdint.h有问题,我应该如何在Cython中进行呢?

编辑:

我的gcc在/usr/bin/gcc中

gcc --version

说明:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1

Apple LLVM version 9.0.0 (clang-900.0.38)

Target: x86_64-apple-darwin17.2.0

Thread model: posix

InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值