python运行报警告:Cython directive 'language_level' not set, using '3str' for now (Py3)

相关:

https://stackoverflow.com/questions/34603628/how-to-specify-python-3-source-in-cythons-setup-py



cython的setup.py文件内容:


from distutils.core import setup
from Cython.Build import cythonize

setup(
  name = 'Great Circle module v1',
  ext_modules = cythonize("great_circle_cy_v1.pyx", ),
)

执行cython编译:

python great_circle_setup_v1.py build_ext --inplace


报出警报:( 不影响编译运行 )

image







修改cython的setup.py编译文件内容:

from distutils.core import setup
from Cython.Build import cythonize

setup(
  name = 'Great Circle module v1',
  ext_modules = cythonize("great_circle_cy_v1.pyx", 
                          compiler_directives={'language_level' : "3"}
                          # or "2" or "3str"
                          ),
)

不再报警告。



posted on 2024-07-25 18:37  Angry_Panda  阅读(430)  评论(0)    收藏  举报

导航