安装程序.py
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy
extensions = [
Extension("word2vec_inner", ["word2vec_inner.pyx"],
include_dirs=[numpy.get_include()])
]
setup(
name="word2vec_inner",
ext_modules=cythonize(extensions),
)
错误:
Warning: Extension name 'word2vec_inner' does not match fully qualified name
'TWE-1.gensim.models.word2vec_inner' of 'word2vec_inner.pyx'
Compiling word2vec_inner.pyx because it changed.
[1/1] Cythonizing word2vec_inner.pyx
Error compiling Cython file:
------------------------------------------------------------
...
#!/usr/bin/env cython
^
------------------------------------------------------------
word2vec_inner.pyx:1:0: 'TWE-1.gensim.models.word2vec_inner' is not a valid
module name
Traceback (most recent call last):
File "D:\PyCharm 2017.3\helpers\pydev\pydevd.py", line 1668, in <module>
main()
File "D:\PyCharm 2017.3\helpers\pydev\pydevd.py", line 1662, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "D:\PyCharm 2017.3\helpers\pydev\pydevd.py", line 1072, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "D:/pycharm/TWE/TWE-1/gensim/models/setup.py", line 11, in <module>
ext_modules=cythonize(extensions),
File "E:\Python27\lib\site-packages\cython-0.27.3-py2.7-
win32.egg\Cython\Build\Dependencies.py", line 1039, in cythonize
cythonize_one(*args)
File "E:\Python27\lib\site-packages\cython-0.27.3-py2.7-
win32.egg\Cython\Build\Dependencies.py", line 1161, in cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: word2vec_inner.pyx
我已经为 Python 2.7 和 cython 安装了 Microsoft Visual C++ 编译器,但它无法编译。总是出现这个问题。如何解决这个问题呢?非常感谢!