Gensim安装问题

时间:2016-11-22 01:20:35

标签: python pip gensim

我正在尝试使用以下方法在Google云端实例上安装gensim:

  

pip3安装gensim

这是我尝试导入gensim时的堆栈跟踪:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/dist-packages/gensim/__init__.py", line 6, in <module>
    from gensim import parsing, matutils, interfaces, corpora, models, similarities, summarization
  File "/usr/local/lib/python3.4/dist-packages/gensim/models/__init__.py", line 7, in <module>
    from .coherencemodel import CoherenceModel
  File "/usr/local/lib/python3.4/dist-packages/gensim/models/coherencemodel.py", line 30, in <module>
    from gensim.models.wrappers import LdaVowpalWabbit, LdaMallet
  File "/usr/local/lib/python3.4/dist-packages/gensim/models/wrappers/__init__.py", line 5, in <module>
    from .ldamallet import LdaMallet
  File "/usr/local/lib/python3.4/dist-packages/gensim/models/wrappers/ldamallet.py", line 43, in <module>
    from smart_open import smart_open
  File "/usr/local/lib/python3.4/dist-packages/smart_open/__init__.py", line 1, in <module>
    from .smart_open_lib import *
  File "/usr/local/lib/python3.4/dist-packages/smart_open/smart_open_lib.py", line 36, in <module>
    import boto.s3.key
  File "/usr/local/lib/python3.4/dist-packages/boto/s3/key.py", line 33, in <module>
    import boto.utils
  File "/usr/local/lib/python3.4/dist-packages/boto/__init__.py", line 1216, in <module>
    boto.plugin.load_plugins(config)
AttributeError: 'module' object has no attribute 'plugin'

这是linux版本(lsb_release -a的输出):

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.6 (jessie)
Release:    8.6
Codename:   jessie

这是

的输出
  

pip3冻结

Cython==0.25.1
Flask==0.11.1
Jinja2==2.8
MarkupSafe==0.23
Pillow==2.6.1
Werkzeug==0.11.11
beautifulsoup4==4.3.2
boto==2.43.0
bz2file==0.98
chardet==2.3.0
click==6.6
colorama==0.3.2
decorator==3.4.0
gensim==0.13.3
html5lib==0.999
itsdangerous==0.24
lxml==3.4.0
matplotlib==1.4.2
nltk==3.2.1
nose==1.3.4
numexpr==2.4
numpy==1.11.2
pandas==0.14.1
pyparsing==2.0.3
python-apt==0.9.3.12
python-dateutil==2.2
pytz==2012c
requests==2.4.3
scipy==0.14.0
six==1.8.0
smart-open==1.3.5
stop-words==2015.2.23.1
tables==3.1.1
unattended-upgrades==0.1
urllib3==1.9.1
wheel==0.24.0

任何人都可以给我指点!这非常令人沮丧。

3 个答案:

答案 0 :(得分:19)

有同样的问题,如果有人偶然发现:GCE以某种方式被打破

  

pip install google-compute-engine

来自https://github.com/GoogleCloudPlatform/compute-image-packages/issues/262

作品

答案 1 :(得分:2)

修正了它:

  

sudo pip3 uninstall boto

     

sudo pip3 install boto

这似乎是一个谷歌计算云的事情。

答案 2 :(得分:0)

此问题主要是由于boto插件或配置文件中存在垃圾造成的。 因此,如@vJune所建议,我们需要卸载boto库,然后再次安装它。 我仅通过删除python-boto软件包就解决了这个问题。

在Google Compute Engine上:

第一步:卸载python-boto软件包

sudo apt-get remove python-boto

Step2:安装python-boto库

sudo apt-get install python-boto