Getting an error to install pyemd even though I just installed it

mad*_*aks 5 python installation gensim word2vec

Here is the code:

from pyemd import emd

print("sentence 1:")
print(input_document_lower[0])
print("sentence 2:")
print(input_document_lower[1])
print("similarity:")
model_w2v.wmdistance(input_document_lower[0], input_document_lower[1])
Run Code Online (Sandbox Code Playgroud)

Here's the error:

sentence 1:
incorrect batch number printed primary label pbn
sentence 2:
unconfirmed oos met vial washing qualification sample per 
similarity:

ImportErrorTraceback (most recent call last)
<ipython-input-201-50af089a2354> in <module>()
      4 print(input_document_lower[1])
      5 print("similarity:")
----> 6 model_w2v.wmdistance(input_document_lower[0], input_document_lower[1])

C:\ProgramData\Anaconda2\lib\site-packages\gensim\models\word2vec.pyc in wmdistance(self, document1, document2)
   1308         Refer to the documentation for `gensim.models.KeyedVectors.wmdistance`
   1309         """
-> 1310         return self.wv.wmdistance(document1, document2)
   1311 
   1312     def most_similar_cosmul(self, positive=None, negative=None, topn=10):

C:\ProgramData\Anaconda2\lib\site-packages\gensim\models\keyedvectors.pyc in wmdistance(self, document1, document2)
    386 
    387         if not PYEMD_EXT:
--> 388             raise ImportError("Please install pyemd Python package to compute WMD.")
    389 
    390         # Remove out-of-vocabulary words.

ImportError: Please install pyemd Python package to compute WMD.
Run Code Online (Sandbox Code Playgroud)

It is being installed properly so I really have no clue as to what is going wrong. Have any of your encountered this?

wes*_*sel 5

我有同样的错误,对我来说,解决方案是交换:

from gensim.similarities import WmdSimilarity
from pyemd import emd
Run Code Online (Sandbox Code Playgroud)

进入

from pyemd import emd
from gensim.similarities import WmdSimilarity
Run Code Online (Sandbox Code Playgroud)

不要问我为什么有效。


Vla*_*mir 0

我遇到了一些问题,我在虚拟环境中安装了这个软件包,但它不起作用。然后我重新启动了计算机,然后它就可以工作了。