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

2024-06-25 23:02:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经安装了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. 

我如何解决这个问题


Tags: infrompyimportlibpackageslinesite