WINDOWS使用FastText:快速的文本分类器

参考 https://www.cs.mcgill.ca/~mxia3/FastText-for-Windows/

https://github.com/xiamx/fastText/releases

 https://blog.csdn.net/john_bh/article/details/79268850

https://blog.csdn.net/grafx/article/details/78697881

https://github.com/xiamx/fastText/releases

https://blog.csdn.net/m0_37870649/article/details/80935307 -- NOW

https://github.com/facebookresearch/fastText

https://blog.csdn.net/watfe/article/details/80018754

https://arxiv.org/pdf/1607.04606v1.pdf

https://github.com/facebookresearch/fastText

-----------------------begin--------------------这些是用 python 进行编译的,但是没有调用-------------------------------------------

先安装 python-3.7.2-amd64.exe 

然后 cmd窗口中 E:\ljtProj\fastText\fastText-master>C:\Users\Administrator\AppData\Local\Programs\Python\Python37\python.exe   setup.py install

  如下图所示:

出现错误:

error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools":   -- 说明需要VS2015的相关的库。https://visualstudio.microsoft.com/downloads/

下载  https://download.visualstudio.microsoft.com/download/pr/100493959/73e1ab8917c6ee08fb03a230865b9401/VC_redist.x64.exe

https://download.visualstudio.microsoft.com/download/pr/100486102/9ca0bba83015c844cc98d7cb783370e9/VC_redist.x86.exe

安装后,执行如下命令:

E:\ljtProj\fastText>C:\Users\Administrator\AppData\Local\Programs\Python\Python37\Scripts\pip.exe   install pycrypto 
E:\ljtProj\fastText>C:\Users\Administrator\AppData\Local\Programs\Python\Python37\Scripts\pip.exe  install --upgrade setuptools

如下图所示:

我是安装的VS2015,安装好后执行命令  E:\ljtProj\fastText\fastText-master>python setup.py install  ,出现如下错误:

command 'cl.exe' ailed:No such file or directory ,说明VS2015安装的不全,选择VS2015中的Visual C++部分的安装,然后发现F:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin 下面有 cl.exe了,再次  E:\ljtProj\fastText\fastText-master>python setup.py install ,又提示错误,如下所示:

error:  pybind11 requires MSVC 2015 update 3 or newer --- 好吧,需要安装  MSVC 2017 相关的组件 ,下面安装:

适用于桌面的 VC++ 2015.3 v140(v140)工具集安装。

如图所示:

再次编译,出现:

说明还是VS2017没安装完全,下面再次安装其它的:

此时再运行  E:\ljtProj\fastText\fastText-master>python setup.py install ,如下图所示:

编译后如下所示:

在 E:\ljtProj\fastText\fastText-master\build\temp.win-amd64-3.7\Release\python\fastText\pybind  文件夹中有 fasttext_pybind.cp37-win_amd64.lib

-----------------------end    --------------------这些是用 python 进行编译的,但是没有调用-------------------------------------------

-----------------------begin  --------------------这些是用 VS 进行编译的,有调用-------------------------------------------

下面进行cmakelist来进行:

https://github.com/facebookresearch/fastText/pull/39

下面安装VS2017

但是还是出这个 错误,难道是因为编译器默认是32位??下面手动选择为64位

编译后,OK,现在只有一个ERROR,

错误消息为 5>LINK : fatal error LNK1181: 无法打开输入文件“pthread.lib”

下面解决这个 问题:

发现只有 fasttext-bin 才会出现问题,暂时不管:

当然,为了解决 pthread.lib 的问题,网上一个人,直接在 CMakeLists.txt 中删除了有关 pthread 的内容,如下:

---这个人的做法,可以借鉴。

下面是调用代码:

其中 fasttext-bin 是库写的调用函数,可以依照其进行库的使用链接,如下所示:

将 E:\ljtProj\fastText\fastText-master\src\main.cc COPY进测试的main.cpp. 因为 E:\ljtProj\fastText\fastText-master\src\main.cc 是源码写的测试的主程序,编译 test_fastText,成功。

应该是要建立模型,背景资料: https://radimrehurek.com/gensim/models/fasttext.html

后面考虑把源码加入测试代码中,如果成功,那么说明直接用源码编译一个LIB,也是可以成功的。

-----------------------begin  --------------------这些是用 VS 进行编译的,有调用-------------------------------------------

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值