Python 构建 scipy 错误 cythonize 失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15175135/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
build scipy error cythonize failed
提问by Liatz
I'm trying to build scipy and I get a RuntimeError:
我正在尝试构建 scipy,但出现 RuntimeError:
$sudo python setup.py build
Processing scipy/cluster/_vq_rewrite.pyx
Traceback (most recent call last):
File "tools/cythonize.py", line 172, in <module>
main()
File "tools/cythonize.py", line 168, in main
find_process_files(root_dir)
File "tools/cythonize.py", line 160, in find_process_files
process(cur_dir, fromfile, tofile, function, hash_db)
File "tools/cythonize.py", line 137, in process
processor_function(fromfile, tofile)
File "tools/cythonize.py", line 66, in process_pyx
raise OSError('Cython needs to be installed')
OSError: Cython needs to be installed
Traceback (most recent call last):
File "setup.py", line 209, in <module>
setup_package()
File "setup.py", line 202, in setup_package
generate_cython()
File "setup.py", line 147, in generate_cython
raise RuntimeError("Running cythonize failed!")
RuntimeError: Running cythonize failed!
What are the ways to provide cython to remedy this error?
提供cython的方法有哪些来补救这个错误?
回答by Liatz
Python setuptools solved the problem.
Python setuptools 解决了这个问题。
http://docs.cython.org/src/quickstart/install.htmleasy_install cythonor pip install cython
http://docs.cython.org/src/quickstart/install.htmleasy_install cython或pip install cython
回答by SuperKogito
If you do not have Cython installed then use: pip install Cython.
However, if you do have an old version of Cython installed like me then this is what solved it for me: pip install --upgrade Cython
如果您没有安装 Cython,请使用:pip install Cython. 但是,如果您确实像我一样安装了旧版本的 Cython,那么这就是为我解决的问题:pip install --upgrade Cython

