fasttext 安装_centos6的python2.7安装fasttext

要求:

(gcc-4.6.3 or newer) or (clang-3.3 or newer)

注:centos6默认的gcc是4.4;

python2.7:

pip install cython

pip install fasttext

douban源加速:pip install fasttext --trusted-host pypi.doubanio.com

报错:gcc版本问题的话自行升级;

fasttext/fasttext.c编译错误,大致的问题是:

cython会将fasttext.pyx转换成fasttext.c并编译;

实际上根据language="c++"看出需要的是fasttext.cpp,而且已经有这个文件;

因此关键点是如何让gcc编译fasttext.cpp;

从cython源码来看:

./python27/lib/python2.7/site-packages/Cython/Build/Dependencies.py

extension的sources包含了fasttext/fasttext.c,直接改成fasttext/fasttext.cpp即可;

def create_extension_list中:

patterns[0].sources[0] = 'fasttext/fasttext.cpp'Installing collected packages: future, fasttext

Running setup.py install for future ... done

Running setup.py install for fasttext ... error

Complete output from command /data/python27/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-gkLUbb/fasttext/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-gqusvF/install-record.txt --single-version-externally-managed --compile:

running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/fasttext

copying fasttext/model.py -> build/lib.linux-x86_64-2.7/fasttext

copying fasttext/__init__.py -> build/lib.linux-x86_64-2.7/fasttext

running build_ext

building '*' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/fasttext

creating build/temp.linux-x86_64-2.7/fasttext/cpp

creating build/temp.linux-x86_64-2.7/fasttext/cpp/src

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/data/python27/include/python2.7 -c fasttext/fasttext.c -o build/temp.linux-x86_64-2.7/fasttext/fasttext.o -O3 -pthread -funroll-loops -std=c++0x

gcc: fasttext/fasttext.c: No such file or directory

gcc: no input files

error: command 'gcc' failed with exit status 1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值