CentOS 6.6 x64安装TensorFlow

CentOS 6.6 x64安装TensorFlow

  1. 升级Python到2.7(系统自带Python版本为2.6)
    // 安装编译工具
     $ yum -y install gcc automake autoconf libtool make

    // 安装依赖库
     $  yum install -y zlib-devel openssl-devel bzip2-devel

    // 下载编译Python
     $ wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
     $ tar zxvf Python-2.7.13.tgz
     $ cd Python-2.7.13
     $ ./configure
     $ make && make install

   // 更新系统默认Python

     $ mv /usr/bin/python /usr/bin/python2.6.6
     $ ln -s /usr/local/bin/python2.7 /usr/bin/python

   // 修改yum所使用Python版本为2.6
     $ vi /usr/bin/yum
     #!/usr/bin/python  修改为 #!/usr/bin/python2.6.6

   // 安装setup-tools
     $ wget https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg  --no-check-certificate
     $ chmod +x setuptools-0.6c11-py2.7.egg
     $ sh setuptools-0.6c11-py2.7.egg

2.安装pip工具

    $ wget https://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz  --no-check-certificat
    $ tar zxvf pip-1.3.1.tar.gz
    $ cd pip-1.3.1
    $ python setup.py install
    $ ln -s /usr/local/python2.7/bin/pip /usr/bin/pip

3.安装TensorFlow

    $ pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0rc0-cp27-none-linux_x86_64.whl

可能出现的问题: 报错”Can’t find setup.py”
解决方案:使用pip install –upgrade pip命令升级pip

4.升级GLIBC到2.17

    $ wget http://ftp.gnu.org/gnu/libc/glibc-2.17.tar.gz
    $ tar -zxvf glibc-2.17.tar.gz
    $ cd glibc-2.17
    $ mkdir build
    $ cd build
    $ ../configure  --prefix=/usr --with-headers=/usr/include --with-binutils=/usr/bin
    $ make && make install

5.升级GCC到4.8.3

   $ wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.3/gcc-4.8.3.tar.gz
   $ tar -zxvf gcc-4.8.3.tar.gz
   $ cd gcc-4.8.3
   $ ./contrib/download_prerequisites 
   $ mkdir build
   $ cd build
   $ yum -y install gcc-c++
   $ ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
   $ make && make install
   $ cp ./stage1-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.19  /usr/lib64
   $ cd /usr/lib64
   $ rm -f /usr/lib64/libstdc++.so.6
   $ ln -s libstdc++.so.6.0.19 libstdc++.so.6

6.测试TensorFlow

  $ python
  >> import tensorflow as tf
  >> hello = tf.constant('Hello World!')
  >> with tf.Session() as sess:
  >>       output = sess.run(hello)
  >> print output

测试结果输出:Hello,World!

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值