我正在尝试构建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!
提供cython来纠正这个错误的方法是什么?
Python setuptools解决了这个问题。
http://docs.cython.org/src/quickstart/install.html easy_install cython
或pip install cython
如果您没有安装Cython,则使用:pip install Cython
。但是,如果您像我一样安装了旧版本的Cython,那么这就是解决问题的方法:pip install --upgrade Cython
对于我来说,这个问题是由于不兼容的python + pandas版本,由于不正确的环境配置,尽管使用了Anaconda。通过pip安装Cython也可以工作,但这不是真正的解决方案。
我安装了Cython
,但没有解决问题。我通过升级我的pip解决了这个问题:pip3 install --upgrade pip
。