您必须
setup.py在终端中运行文件。这是一个使用的例子
numpy
try: from setuptools import setup from setuptools import Extensionexcept importError: from distutils.core import setup from distutils.extension import Extensionfrom Cython.Distutils import build_extimport numpy as npext_modules = [Extension("my_pre_cython",["my_pre_cython.pyx"]), Extension("another_pre_cython",["another_pre_cython.pyx"])]setup( name= 'Generic model class', cmdclass = {'build_ext': build_ext}, include_dirs = [np.get_include()], ext_modules = ext_modules)在终端(Windows中为cmd)中,您必须执行命令
python setup.py build_ext --inplace
重要的是,我想您已经安装了编译器(例如,适用于Python 2.7的Microsoft Visual C
++编译器软件包)。您可以在https://github.com/cython/cython/wiki/CythonExtensionsOnWindows中找到更多信息



