简体   繁体   中英

How to fix error when installing annoy in python

I am installing annoy in python 3.5-3.2 Windows 10 to create similarities.index. This is C++ library with Python bindings. I do this: pip install annoy. On the step c++ translation I recieved error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2. How to fix it? (I know about "Issues in install annoy python package" but it does not help)

I am not shure that this is universal but now it works: Under Windows 10 Visula studio 2017 with c++ and python 3.6 is installed. And I use Python 3.7 64. Annoy installed by pip install annoy and simple script was run:

from gensim.similarities.index import AnnoyIndexer
from gensim.models import Word2Vec

sentences = [['cute', 'cat', 'say', 'meow'], ['cute', 'dog', 'say', 'woof']]
model = Word2Vec(sentences, min_count=1, seed=1)

indexer = AnnoyIndexer(model, 2)
x=model.most_similar("cat", topn=2, indexer=indexer)
print("cat - most similar 2 words = ",x)

The result is not good: cat - woof, but I think this is because very small data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM