CentOS 6.6 x64安装TensorFlow

CentOS 6.6 x64安装TensorFlow
升级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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
1
2
3
4
5
3.安装TensorFlow

$ pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0rc0-cp27-none-linux_x86_64.whl
1
可能出现的问题: 报错”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
1
2
3
4
5
6
7
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
1
2
3
4
5
6
7
8
9
10
11
12
13
6.测试TensorFlow

$ python
>> import tensorflow as tf
>> hello = tf.constant('Hello World!')
>> with tf.Session() as sess:
>> output = sess.run(hello)
>> print output
1
2
3
4
5
6
测试结果输出:Hello,World!
---------------------
作者:numen27
来源:CSDN
原文:https://blog.csdn.net/numen27/article/details/75332833
版权声明:本文为博主原创文章,转载请附上博文链接!

原文地址:https://www.cnblogs.com/wangsongbai/p/10844144.html