在centos6环境下安装TensorFlow

The official-released binary packages of TensorFlow are built for newer version of Linux distros. Here is how to build TensorFlow binary package for CentOS 6.

Install Dependencies

Admin privilege is required here.

OpenJDK (for Bazel)

Developer Toolset (for Bazel and TensorFlow)

C++11 compatible compiler is required during the building process. Follow the instructions in this article to install Developer Toolset. It is worth noting that, in this case, installing just devtoolset-6-toolchain would be sufficient.

Python 2.7 (for TensorFlow)

This step also requires Software Collections installed. Therefore, if you’ve installed Developer Toolset by following the instructions above, you should have no problem installing these dependencies.

Build and Install Bazel

Enter Build Environment

Enter Software Collection environment with Developer Toolset.

Prepare Source Code
Method 1 (Recommended)

The standard way of compiling a release version of Bazel from source is to use a distribution archive. From version 0.4.1, bootstrapping Bazel from GitHub repository is no longer supported as only the distribution archives contain generated artifacts required for direct compilation. Download bazel-<VERSION>-dist.zip from the release page.

Method 2 (Only Works for Version <= 0.4.0)

Build and Install

Build TensorFlow with Bazel

Enter Build Environment

Enter Software Collection environment with Developer Toolset and Python 2.7.

Prepare Source Code

Since GNU C library version in CentOS 6 is less than 2.17, a slight modification needs to be applied before compilation.

Modify tf_extension_linkopts function in tensorflow/tensorflow.bzl from

to

Build

After above modification, we can now start building!

Remember to disable jemalloc when configuring — otherwise the build will fail.

Finishing Up

Finally, you will found a tensorflow-1.1.0-cp27-none-linux_x86_64.whl (filename may vary upon versions) in /tmp/tensorflow_pkg/. With this self-built binary package, we can now deploy TensorFlow to CentOS 6 by pip.

Enter Python Environment on Deployment Target

Enter Python 2.7 environment either by Software Collection or by tools like pyenv.

Install

Depending on your environment setup, admin privilege might be needed here.

References

  1. Installing TensorFlow from Sources – TensorFlow
  2. Compiling from source – Installing Bazel – Bazel
  3. Distribution Artifact for Bazel – Bazel
  4. ImportError: undefined symbol: clock_gettime #121
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值