编译第一个cython程序时出错

end*_*x1x 4 python compiler-errors cython

我正在尝试开始使用 cython 并尝试编译我的第一个程序。我用以下代码创建了一个 hello.pyx:

def show():
    print ("Hello World")
Run Code Online (Sandbox Code Playgroud)

和一个带有以下代码的 setup.py:

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

ext_modules = [Extension("hello", ["hello.pyx"])]

setup(
    name = 'Hello world app',
    cmdclass = {'build_ext': build_ext},
    ext_modules = ext_modules
)
Run Code Online (Sandbox Code Playgroud)

两者都在我称为“cython 程序”的文件夹中,该文件夹位于 C:\Python32\cython 程序。Cython 位于 C:\Python32\Lib\site-packages\Cython。但是,当我运行 setup.py 时,出现以下错误:

Traceback (most recent call last):
  File "C:\Python32\cython programs\setup.py", line 10, in <module>
    ext_modules = ext_modules
  File "C:\Python32\lib\distutils\core.py", line 136, in setup
    raise SystemExit(gen_usage(dist.script_name) + "\nerror: %s" % msg)
SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied
Run Code Online (Sandbox Code Playgroud)

我猜我错过了一些非常简单的东西,但我似乎无法弄清楚它是什么。任何帮助,将不胜感激。

Hen*_*all 5

运行python setup.py build_ext。这对我行得通。