在Ubuntu中从源码编译TensorFlow

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在Ubuntu中从源码编译TensorFlow相关的知识,希望对你有一定的参考价值。

这里展示从源码编译得TensorFlow的过程。

原版教程在github上https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#installing-from-sources

首先是安装构建工具Bazel(http://www.bazel.io/docs/install.html#install-on-ubuntu)

Install on Ubuntu

Install JDK 8

If you are running Ubuntu Wily (15.10), you can skip this step. But for Ubuntu Trusty (14.04 LTS) users, since OpenJDK 8 is not available on Trusty, please install Oracle JDK 8:

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
Note: You might need to sudo apt-get install software-properties-common if you don‘t have the add-apt-repository command. See here.

1. Add Bazel distribution URI as a package source (one time setup)

$ echo "deb http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
$ curl https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg | sudo apt-key add -
If you want to use the JDK 7, please replace jdk1.8 with jdk1.7 and if you want to install the testing version of Bazel, replace stable with testing.

2. Update and install Bazel

$ sudo apt-get update && sudo apt-get install bazel

Once installed, you can upgrade to newer version of Bazel with:

$ sudo apt-get upgrade bazel

 

以上是关于在Ubuntu中从源码编译TensorFlow的主要内容,如果未能解决你的问题,请参考以下文章

linux 安装tensorflow(gpu版本)

在 Ubuntu Linux 中从 Eclipse 交叉编译 Windows 应用程序?

在Ubuntu中构建的Tensorflow MKL-DNN会默默地产生错误结果

ubuntu16.04 源码安装Python3.7 并在此基础上安装Tensorflow (确保Tensorflow计算框架与系统的彻底隔离)

在 ubuntu 上使用 linux 源码编译模块

Ubuntu16.04下 编译安装 Tensorflow