gensim error : no module named gensim

woojung picture woojung · Sep 12, 2017 · Viewed 58.1k times · Source

I trying to import gensim.

I have the following code

import gensim
model = gensim.models.Word2Vec.load_word2vec_format('./model/GoogleNews-  
vectors-negative300.bin', binary=True)  

I got the following error.

ImportError                               Traceback (most recent call  
last)
<ipython-input-5-50007be813d4> in <module>()
----> 1 import gensim
  2 model = gensim.models.Word2Vec.load_word2vec_format('./model  
/GoogleNews-vectors-negative300.bin', binary=True)

ImportError: No module named 'gensim'

I installed gensim in python. I use genssim for word2vec.

Answer

Tanu picture Tanu · Sep 12, 2017

Install gensim using:

pip install -U gensim

Or, if you have instead downloaded and unzipped the source tar.gz package, then run:

python setup.py test
python setup.py install