python安装gensim==3.5.0 版本后,import gensim 报错unable to import 'smart_open.gcs', disabling that module,网上查询后解决办法是pip install smart_open==1.10.0 ,但是安装命令报错:
AttributeError: '_NamespacePath' object has no attribute 'sort'
继续查找解决方法,原因是需要升级setuptools ,先卸载:
# pip list | grep -i setup
setuptools 28.8.0
pip uninstall setuptools==28.8.0
Found existing installation: setuptools 28.8.0
Uninstalling setuptools-28.8.0:
Would remove:
/usr/local/Python-3.6.1/bin/easy_install-3.6
/usr/local/Python-3.6.1/lib/python3.6/site-packages/easy_install.py
/usr/local/Python-3.6.1/lib/python3.6/site-packages/pkg_resources/*
/usr/local/Python-3.6.1/lib/python3.6/site-packages/setuptools-28.8.0.dist-info/*
/usr/local/Python-3.6.1/lib/python3.6/site-packages/setuptools/*
Proceed (y/n)? y
Successfully uninstalled setuptools-28.8.0
安装新版本setuptools
pip install setuptools
然后重新安装smart_open,
pip install smart_open==1.10.0
再次执行import gensim就没有报错了
>>> import gensim
>>>