compiler-errors - Cython 教程编译失败 [OSX]
问题描述
我尝试按照 cython 的教程进行操作。
在制作 hello.pyx/setup.py 文件后,我执行它进行编译
$ python setup.py build_ext --inplace
但我得到的是这样的。
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:220:5: error: 'TARGET_OS_EMBEDDED' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_EMBEDDE
.
.
.
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:181:5: error: 'TARGET_OS_E
MBEDDED' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_EMBEDDED
^
.
.
.
194 warnings and 2 errors generated.
error: command 'clang' failed with exit status 1
因为错误/警告消息很长。我贴了一部分。
解决方案
它对我有用!
$ export CC=gcc
$ python setup.py build_ext --inplace
# success!
环境价值是重点。
推荐阅读
- node.js - 为什么在给定相同输入的情况下节点 scrypt 哈希值相同?
- r - 用于创建新变量的函数在 R 中不起作用
- java - 获取 SQLiteOpenHelper 构造函数的上下文
- sqlite - Sqlite3 Case 语句怪异
- ios - 从 Firebase 查询中检索深层数据(iOS、Swift 4)
- flutter - 如何处理不同的图标大小
- c - 共享对象上的 setuid 位
- gpu - 训练分割模型,4 个 GPU 工作,1 个填充并得到:“CUDA 错误:内存不足”
- javascript - 带有标签样式的复选框的不确定css样式
- jquery - 当 URL 包含预定义值时插入 html