关于python:如何使用Cython安装带有setup.py的模块?

How can a module with setup.py installed using Cython?

首先,我对python没有任何经验。 我只想在setup.py随附的Blender中安装模块。 看来我需要Cython来安装它。 我将Cython添加到PYTHONPATH,并将bin文件夹添加到PATH。 显示此错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
python setup.py install
running install
running build
running build_ext
Traceback (most recent call last):
  File"setup.py", line 17, in <module>
    cmdclass = {'build_ext': build_ext})
  File"C:\\Python33\\lib\\distutils\\core.py", line 148, in setup
    dist.run_commands()
  File"C:\\Python33\\lib\\distutils\\dist.py", line 917, in run_commands
    self.run_command(cmd)
  File"C:\\Python33\\lib\\distutils\\dist.py", line 936, in run_command
    cmd_obj.run()
  File"C:\\Python33\\lib\\distutils\\command\\install.py", line 569, in run
    self.run_command('build')
  File"C:\\Python33\\lib\\distutils\\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File"C:\\Python33\\lib\\distutils\\dist.py", line 936, in run_command
    cmd_obj.run()
  File"C:\\Python33\\lib\\distutils\\command\\build.py", line 126, in run
    self.run_command(cmd_name)
  File"C:\\Python33\\lib\\distutils\\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File"C:\\Python33\\lib\\distutils\\dist.py", line 936, in run_command
    cmd_obj.run()
  File"C:\\Cython-0.19.1\\Cython\\Distutils\\build_ext.py", line 163, in run
    _build_ext.build_ext.run(self)
  File"C:\\Python33\\lib\\distutils\\command\\build_ext.py", line 354, in run
    self.build_extensions()
  File"C:\\Cython-0.19.1\\Cython\\Distutils\\build_ext.py", line 170, in build_extensions
    ext.sources = self.cython_sources(ext.sources, ext)
  File"C:\\Cython-0.19.1\\Cython\\Distutils\\build_ext.py", line 181, in cython_sources
    from Cython.Compiler.Main \\
  File"C:\\Cython-0.19.1\\Cython\\Compiler\\Main.py", line 302
    except UnicodeDecodeError#, e:
                                 ^
SyntaxError: invalid syntax

版本包括:Python 3.3 / Windows7 64 / Cython-0.19.1

有什么想法,我应该尝试什么?


您的Cython安装似乎已损坏。 您可能需要考虑全新安装,也许是从适用于Python 3.3的Cython Windows安装程序中获取的。