使用打印功能参数进行cython错误编译 [英] cython error compiling with print function parameters
本文介绍了使用打印功能参数进行cython错误编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当使用cython从helloworld.pyx创建helloworld.c时,发生此错误:
when use cython to create helloworld.c from helloworld.pyx , this error occured:
error compiling Cython file:
------------------------------------------------------------
...
print('hello world',end='')
^
------------------------------------------------------------
p21.pyx:1:23: Expected ')', found '='
创建helloworld.c的命令是:
my command to create helloworld.c is:
cython3 --embed p21.pyx
推荐答案
Cython默认使用Python 2语义。将语言级别设置为3,可以通过以下注释完成:
Cython is defaulting to Python 2 semantics. Set the language level to 3, which can be done with the following comment:
#cython: language_level=3
参考: https://cython.readthedocs.io/en/stable/src/reference/compilation.html#compiler-directives
这篇关于使用打印功能参数进行cython错误编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文