CentOS 7中编译安装Warp-ctc及启用更高版本GCC(4.9.2)

22 篇文章 1 订阅
4 篇文章 0 订阅

识别验证码用到warp-ctc,原版百度的不支持pytorch,找到https://github.com/SeanNaren/warp-ctc,按说明,需要gcc-4.9,接着又其他报错,下面是解决过程:

1 CentOS 7中默认gcc版本为4.8.5,编译warp-ctc提示需要4.9版本的gcc,通过以下命令:

1 yum install centos-release-scl-rh centos-release-scl

2 yum check-update

3 yum install devtoolset-3

4 scl enable devtoolset-3 bash

2 编译warp-ctc提示错误:

In file included from /root/anaconda2/lib/python2.7/site-packages/torch/include/ATen/cuda/CUDAContext.h:5:0,
                 from src/binding.cpp:9:
/root/anaconda2/lib/python2.7/site-packages/torch/include/c10/cuda/CUDAStream.h:6:30: fatal error: cuda_runtime_api.h: No such file or directory
 #include <cuda_runtime_api.h>
                              ^
compilation terminated.
error: command 'gcc' failed with exit status 1

修改warp-ctc/pytorch_binding下面的setup.py文件

extra_compile_args = ['-std=c++11', '-fPIC']

为:

extra_compile_args = ['-std=c++11', '-fPIC','-I/usr/local/cuda/include']

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值