Linux下python的word2vec安装

这里的word2vec程序是miklov他们的原生的接口、
一般来说建议使用

$ pip install word2vec

会遇到

('Compilation command:', 'gcc /tmp/pip-build-sWAR1E/word2vec/word2vec/c/word2vec.c -o bin/word2vec -march=corei7')
    /tmp/cciCPwRP.o:在函数‘InitUnigramTable’中:
    word2vec.c:(.text+0x7f):对‘pow’未定义的引用
    word2vec.c:(.text+0xf6):对‘pow’未定义的引用
    word2vec.c:(.text+0x196):对‘pow’未定义的引用
    /tmp/cciCPwRP.o:在函数‘TrainModelThread’中:
    word2vec.c:(.text+0x1bcd):对‘sqrt’未定义的引用
    /tmp/cciCPwRP.o:在函数‘TrainModel’中:
    word2vec.c:(.text+0x32e5):对‘pthread_create’未定义的引用
    word2vec.c:(.text+0x3325):对‘pthread_join’未定义的引用
    word2vec.c:(.text+0x3821):对‘sqrt’未定义的引用
    /tmp/cciCPwRP.o:在函数‘main’中:
    word2vec.c:(.text+0x4251):对‘exp’未定义的引用
    collect2: error: ld returned 1 exit status

    ----------------------------------------

只需要加上编译条件:

root@master:/App# CFLAGS='-lpthread -lm' pip install word2vec

Collecting word2vec
  Using cached https://files.pythonhosted.org/packages/5b/33/8e1cf93216342f0fe8aa4484ef1a833a12c4f6d6bf8e8b46ecc0feb5e5e8/word2vec-0.9.2.tar.gz
Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages (from word2vec)
Requirement already satisfied: cython in /usr/local/lib/python2.7/dist-packages (from word2vec)
Building wheels for collected packages: word2vec
  Running setup.py bdist_wheel for word2vec ... done
  Stored in directory: /root/.cache/pip/wheels/89/a1/cb/417bcc7143a3e2befcc82da185ce8ad4a340eb82c0bf48969c
Successfully built word2vec
Installing collected packages: word2vec
Successfully installed word2vec-0.9.2
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值