首页 > 解决方案 > 导入 gensim 并得到一个 TypeError: expected bytes, Descriptor found

问题描述

我尝试在 python3 中导入 gensim 库。所有库都是最新版本。在第一次导入中得到一个TypeError: expected bytes, Descriptor found ,在第二次导入中得到一个这个错误:

 import gensim

> AttributeError                            Traceback (most recent call last)
<ipython-input-7-e70e92d32c6e> in <module>
----> 1 import gensim

~\Anaconda3\lib\site-packages\gensim\__init__.py in <module>
      3 """
      4 

~\Anaconda3\lib\site-packages\smart_open\transport.py in <module>
     20 NO_SCHEME = ''
     21 
---> 22 _REGISTRY = {NO_SCHEME: smart_open.local_file}
     23 
     24 

AttributeError: module 'smart_open' has no attribute 'local_file'

标签: pythonimporttypeerrorgensimattributeerror

解决方案


我通过以下步骤解决了这个问题:

pip install smart-open==1.9.0
pip install gensim==3.4.0

这对我有用


推荐阅读