archlinux下源码编译tensorflow

archlinux下源码编译tensorflow

1. 环境准备

$ sudo pacman -S bazel

2. 下载源码

获取源码

$ git clone https://github.com/tensorflow/tensorflow.git

下载miniconda

目前版本下,python3.6使用就很可以,不下最新的python3.7的miniconda,下载后

$ bash Miniconda3-4.5.1-Linux-x86_64

安装完成后千万不要pip install tensorflow 或者 conda install tensorflow,这样会安装未编译的版本,最后就算是卸载,也要把一些依赖卸载,干脆别装

3. 编译

$ cd (path)/tensorflow  (path)为你git clone下的目录

$ ./configue  (之后一路下去都选no,  其他的默认就可以了)

编译

$ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package  

编译成功后的信息

	At global scope:
	cc1plus: warning: unrecognized command line option '-Wno-self-assign'
	Target //tensorflow/tools/pip_package:build_pip_package up-to-date:
	  bazel-bin/tensorflow/tools/pip_package/build_pip_package
	INFO: Elapsed time: 9402.576s, Critical Path: 397.05s
	INFO: 1944 processes: 1944 local.
	INFO: Build completed successfully, 2104 total actions

生成whl文件

就在tensorflow 目录下

$ bazel-bin/tensorflow/tools/pip_package/build_pip_package ~/tensorflow_pkg

~/tensorflow_pkg是输出目录,之后.wheel文件就在该目录下, 运行输出如下:

2018年 12月 28日 星期五 14:21:09 CST : === Preparing sources in dir: /tmp/tmp.BVOrF1c3FU

~/App/tensorflow ~/App/tensorflow
~/App/tensorflow
2018年 12月 28日 星期五 14:21:27 CST : === Building wheel
warning: no files found matching '*.pyd' under directory '*'
warning: no files found matching '*.pd' under directory '*'
warning: no files found matching '*.dll' under directory '*'
warning: no files found matching '*.lib' under directory '*'
warning: no files found matching '*.h' under directory 'tensorflow/include/tensorflow'
warning: no files found matching '*' under directory 'tensorflow/include/Eigen'
warning: no files found matching '*.h' under directory 'tensorflow/include/google'
warning: no files found matching '*' under directory 'tensorflow/include/third_party'
warning: no files found matching '*' under directory 'tensorflow/include/unsupported'
2018年 12月 28日 星期五 14:22:08 CST : === Output wheel file is in: /home/lee/tensorflow_pkg

4. 安装

cd ~/tensorflow_pkg

pip install tensorflow-1.12.0-cp36-cp36m-linux_x86_64.whl

这里会自动下载依赖,完成

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值