Canon
2012-08-16 20:31:48 UTC
How do I run or compile Cython? So far I have been unable to do either.
Some background:
Windows XP, 32-bit machine
downloaded Python (x,y) 2.7.2.3
(http://code.google.com/p/pythonxy/wiki/Downloads)
I checked the boxes in the python package that would included Cython 0.16
and the MinGW compiler in the installation
I try to follow the steps in this Cython tutorial
(http://docs.cython.org/src/userguide/tutorial.html) but get errors. The
tutorial does not specify where these steps should be performed, maybe it
doesn't matter?
1) I open up IDLE and write:
print "hello world"
2) I save this program as helloworld.pyx, and then close IDLE
ext_modules = [Extension("helloworld",["helloworld.pyx"])]
)
4) after pressing enter I get the following error:
Traceback (most recent call last):
File "<pyshell#6>", line 3, in <module>
ext_modules = [Extension("helloworld",["helloworld.pyx"])]
File "C:\Python27\lib\distutils\core.py", line 140, in setup
raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg
SystemExit: usage: [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: --help [cmd1 cmd2 ...]
or: --help-commands
or: cmd --help
error: no commands supplied
5) If I go onto the next step and type:
$ python setup.py build_ext --inplace
Then I get a syntax error on the dollar sign
What is going on? I get the same errors if I do steps 3-5 in the cmd.exe
Shell.
and the result is a long list of errors.
What is going on???
Some background:
Windows XP, 32-bit machine
downloaded Python (x,y) 2.7.2.3
(http://code.google.com/p/pythonxy/wiki/Downloads)
I checked the boxes in the python package that would included Cython 0.16
and the MinGW compiler in the installation
I try to follow the steps in this Cython tutorial
(http://docs.cython.org/src/userguide/tutorial.html) but get errors. The
tutorial does not specify where these steps should be performed, maybe it
doesn't matter?
1) I open up IDLE and write:
print "hello world"
2) I save this program as helloworld.pyx, and then close IDLE
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
cmdclass = {'build_ext': build_ext},from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
ext_modules = [Extension("helloworld",["helloworld.pyx"])]
)
4) after pressing enter I get the following error:
Traceback (most recent call last):
File "<pyshell#6>", line 3, in <module>
ext_modules = [Extension("helloworld",["helloworld.pyx"])]
File "C:\Python27\lib\distutils\core.py", line 140, in setup
raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg
SystemExit: usage: [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: --help [cmd1 cmd2 ...]
or: --help-commands
or: cmd --help
error: no commands supplied
5) If I go onto the next step and type:
$ python setup.py build_ext --inplace
Then I get a syntax error on the dollar sign
What is going on? I get the same errors if I do steps 3-5 in the cmd.exe
Shell.
import pyximport; pyximport.install()
import helloworld
(I do this in IDLE)import helloworld
and the result is a long list of errors.
What is going on???