【问题标题】:How can a module with setup.py installed using Cython?如何使用 Cython 安装带有 setup.py 的模块?
【发布时间】:2013-08-26 09:47:15
【问题描述】:

首先我没有使用 python 的经验。我只想在带有 setup.py 的搅拌机中安装一个模块。看来我需要 Cython 来安装它。我将 Cython 添加到 PYTHONPATH 并将 bin 文件夹添加到 PATH。显示此错误:

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 installer;试试看?
  • @nneonneo 谢谢,我会试试这个。
  • @nneonneo 这成功了,你想添加这个作为答案吗?

标签: python python-3.x cython


【解决方案1】:

您的 Cython 安装似乎以某种方式损坏。您可能需要考虑重新安装,可能来自Cython Windows installer for Python 3.3

【讨论】:

    猜你喜欢
    • 2018-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-09
    • 2023-03-17
    • 1970-01-01
    • 2020-05-30
    • 1970-01-01
    相关资源
    最近更新 更多