如何在python中安装烦恼时修复错误

时间:2019-03-26 06:14:56

标签: python word2vec

我在python 3.5-3.2 Windows 10中安装了anyy,以创建相似点。这是带有Python绑定的C ++库。我这样做: 点安装烦人。 在步骤C ++翻译中,我收到了 错误:命令“ C:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ VC \ BIN \ cl.exe”失败,退出状态为2。 如何解决? (我知道“安装烦人的python软件包中的问题”,但这无济于事)

1 个答案:

答案 0 :(得分:0)

我不确定这是否通用,但现在可以使用: 在Windows 10下安装了具有c ++和python 3.6的Visula studio 2017。我使用Python 3.764。通过pip install annoy安装了Annoy,并运行了简单的脚本:

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)

结果不好:猫-woof,但是我认为这是因为数据非常小。