不能从'smart_open'导入名称'open'。

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

我这样做,并得到这个错误。

from gensim.models import Word2Vec

ImportError: cannot import name 'open' from 'smart_open' (C:\ProgramData\Anaconda3\lib\site-packages\smart_open\__init__.py)

然后我做了这个 。

import smart_open
dir(smart_open)

['BZ2File','BytesIO','DEFAULT_ERRORS','IS_PY2','P','PATHLIB_SUPPORT','SSLError','SYSTEM_ENCODING','Uri','__builtins__','__cached__','__doc__','__file__','__loader__','__name__','__package__','__path__','__spec__','boto','codecs','collections','gzip','hdfs','http','importlib','io','logger','logging','os','pathlib','pathlib_module','requests','s3','s3_iter_bucket','six','smart_open','smart_open_hdfs','smart_open_http','smart_open_lib','smart_open_s3','smart_open_webhdfs','sys','urlparse','urlsplit','warnings','webhdfs']

如你所见,里面没有 "open",我应该如何解决这个问题。我试着安装不同的版本,我也升级了所有的版本。

deep-learning nlp importerror gensim
1个回答
1
投票

不知为何,当我把smart_open降级然后再升级时,这个问题就解决了,虽然不知道为什么会这样。


1
投票

我也得到了同样的错误。我更新了smart_open到2.0.0版本就解决了。

conda install smart_open==2.0.0。

或者

pip install smart_open==2.0.0.

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