小编lub*_*tep的帖子

禁止来自`cython.inline` 的已弃用的 numpy API 警告

当我cython.inline使用 numpy 参数运行时,编译器会发出一个 numpy 弃用警告。例子:

import cython
import numpy

y = numpy.zeros((1, ))
print(cython.inline('x = y + 1', quiet=True, force=True)['x'])
Run Code Online (Sandbox Code Playgroud)

输出(Python 3.5.2,Cython 0.27.3,numpy 1.13.3):

In file included from /Users/alex/Library/Caches/cython/inline/_cython_inline_71247e2c4c276ce71de47a12a21f4fd3.c:504:
In file included from /Users/alex/.virtualenvs/pysb3/lib/python3.5/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Users/alex/.virtualenvs/pysb3/lib/python3.5/site-packages/numpy/core/include/numpy/ndarrayobject.h:18:
In file included from /Users/alex/.virtualenvs/pysb3/lib/python3.5/site-packages/numpy/core/include/numpy/ndarraytypes.h:1788:
/Users/alex/.virtualenvs/pysb3/lib/python3.5/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by " \
 ^
1 warning generated.
[ 1.]
Run Code Online (Sandbox Code Playgroud)

我无法抑制此警告。在用Cython文档状态的警告是正常的,没有什么后顾之忧,但我的应用程序编译大量的代码cython.inline …

python numpy cython

5
推荐指数
0
解决办法
662
查看次数

标签 统计

cython ×1

numpy ×1

python ×1