运行时错误:Cython 扩展不可用

问题描述 投票:0回答:1

我已经安装了 cython 和 gensim。但是,当我导入 genism 时,会出现以下情况:

Traceback (most recent call last):
  File "C:\Users\DSP\untitled3\lib\site-packages\gensim\matutils.py", line 1426, in <module>
    from gensim.corpora._mmreader import MmReader  # noqa: F401
ModuleNotFoundError: No module named 'gensim.corpora._mmreader'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "untitled1\dfgd.py", line 3, in <module>
    from gensim.models.fasttext import FastText
  File "C:\Users\DSP\untitled3\lib\site-packages\gensim\__init__.py", line 5, in <module>
    from gensim import parsing, corpora, matutils, interfaces, models, similarities, summarization, utils  # noqa:F401
  File "C:\Users\DSP\untitled3\lib\site-packages\gensim\corpora\__init__.py", line 6, in <module>
    from .indexedcorpus import IndexedCorpus  # noqa:F401 must appear before the other classes
  File "C:\Users\DSP\untitled3\lib\site-packages\gensim\corpora\indexedcorpus.py", line 15, in <module>
    from gensim import interfaces, utils
  File "C:\Users\DSP\untitled3\lib\site-packages\gensim\interfaces.py", line 21, in <module>
    from gensim import utils, matutils
  File "C:\Users\DSP\untitled3\lib\site-packages\gensim\matutils.py", line 1428, in <module>
    raise utils.NO_CYTHON
RuntimeError: Cython extensions are unavailable. Without them, this gensim functionality is disabled. If you've installed from a package, ask the package maintainer to include Cython extensions. If you're building gensim from source yourself, run `python setup.py build_ext --inplace` and retry. 

如何解决这个问题?

python import runtime-error cython gensim
1个回答
0
投票

我在 PyCharm 中遇到了这个问题,我的 python 版本是 3.8。
我重新安装了 gensim (3.4.2),我的问题已经解决了。

© www.soinside.com 2019 - 2024. All rights reserved.