centos6.5的tensorflow安装跳坑
2017-07-26 15:03
316 查看
1.首先安装python环境,其实对于任何一台linux机器都已经具备了python环境,但是如果想要事情变得简单的话,可以使用anaconda,anaconda下载地址https://repo.continuum.io/archive/;选择一个版本适中的安装,本人选择2.3.0。anaconda安装完成后,conda、pip等命令就可以用了。
2.安装tensorflow步骤
conda create -n tensorflow python=2.7
source activate tensorflow;
conda install -c conda-forge tensorflow;
source activate tensorflow;
3.出现的问题及跳坑方法
第一个:
wget http://ftp.gnu.org/pub/gnu/glibc/glibc-2.20.tar.xz
xz -d glibc-2.20.tar.xz
tar -xvf glibc-2.20.tar
cd glibc-2.20
mkdir build
cd build
../configure –prefix=/usr –disable-profile –enable-add-ons –with-headers=/usr/include –with-binutils=/usr/bin
make && make install
第二个:
使用“strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX”查看
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH
wget http://ftp.de.debian.org/debian/pool/main/g/gcc-4.7/libstdc++6_4.7.2-5_amd64.deb
ar -x libstdc++6_4.7.2-5_amd64.deb && tar xvf data.tar.gz
cd /root/usr/lib/x86_64-linux-gnu
mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.bak
cp libstdc++.so.6.0.17 /usr/lib64/
cd /usr/lib64/
chmod +x libstdc++.so.6.0.17
ln -s libstdc++.so.6.0.17 libstdc++.so.6
第三个:
从网上下载libstdc++.so.6.0.20 http://download.csdn.net/detail/pomelover/7524227(这个不是博主的上传文件,忠实于版权,我把这个放上来)
放到/usr/lib64/下
chmod +x libstdc++.so.6.0.20
rm libstdc++.so.6
ln -s libstdc++.so.6.0.20 libstdc++.so.6
strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX
再次使用后成功安装,测试如下
本博文后面内容转自http://blog.csdn.net/vfgbv/article/details/54018590
2.安装tensorflow步骤
conda create -n tensorflow python=2.7
source activate tensorflow;
conda install -c conda-forge tensorflow;
source activate tensorflow;
3.出现的问题及跳坑方法
第一个:
import tensorflow as tf Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/python27/lib/python2.7/site-packages/tensorflow/__init__.py", line 23, in <module> from tensorflow.python import * File "/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 45, in <module> from tensorflow.python import pywrap_tensorflow File "/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module> _pywrap_tensorflow = swig_import_helper() File "/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description) ImportError: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by /usr/local/python27/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so)
wget http://ftp.gnu.org/pub/gnu/glibc/glibc-2.20.tar.xz
xz -d glibc-2.20.tar.xz
tar -xvf glibc-2.20.tar
cd glibc-2.20
mkdir build
cd build
../configure –prefix=/usr –disable-profile –enable-add-ons –with-headers=/usr/include –with-binutils=/usr/bin
make && make install
第二个:
import tensorflow as tf Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/python27/lib/python2.7/site-packages/tensorflow/__init__.py", line 23, in <module> from tensorflow.python import * File "/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 45, in <module> from tensorflow.python import pywrap_tensorflow File "/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module> _pywrap_tensorflow = swig_import_helper() File "/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description) ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by /usr/local/python27/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so)
使用“strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX”查看
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH
wget http://ftp.de.debian.org/debian/pool/main/g/gcc-4.7/libstdc++6_4.7.2-5_amd64.deb
ar -x libstdc++6_4.7.2-5_amd64.deb && tar xvf data.tar.gz
cd /root/usr/lib/x86_64-linux-gnu
mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.bak
cp libstdc++.so.6.0.17 /usr/lib64/
cd /usr/lib64/
chmod +x libstdc++.so.6.0.17
ln -s libstdc++.so.6.0.17 libstdc++.so.6
第三个:
import tensorflow as tf Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/python27/lib/python2.7/site-packages/tensorflow/__init__.py", line 23, in <module> from tensorflow.python import * File "/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 45, in <module> from tensorflow.python import pywrap_tensorflow File "/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module> _pywrap_tensorflow = swig_import_helper() File "/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description) ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.19' not found (required by /usr/local/python27/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so)
从网上下载libstdc++.so.6.0.20 http://download.csdn.net/detail/pomelover/7524227(这个不是博主的上传文件,忠实于版权,我把这个放上来)
放到/usr/lib64/下
chmod +x libstdc++.so.6.0.20
rm libstdc++.so.6
ln -s libstdc++.so.6.0.20 libstdc++.so.6
strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX
再次使用后成功安装,测试如下
>>> import tensorflow as tf >>> matrix1 = tf.constant([[3., 3.]]) >>> matrix2 = tf.constant([[2.],[2.]]) >>> product = tf.matmul(matrix1, matrix2) >>> print product Tensor("MatMul:0", shape=(1, 1), dtype=float32) >>> sess = tf.Session() >>> result = sess.run(product) >>> print result [[ 12.]] >>> sess.close() >>> exit()
本博文后面内容转自http://blog.csdn.net/vfgbv/article/details/54018590
相关文章推荐
- [置顶] Centos6.5之pip安装tensorflow
- 在centos6.5 以 anaconda2的方式安装tensorflow
- centos6.5安装tensorflow
- Liunx(Centos6.5)上安装TensorFlow
- centos6.5 安装tensorflow常见问题
- Centos6.5上通过Docker安装Tensorflow
- Liunx(Centos6.5)上安装TensorFlow
- centos6.5安装tensorflow
- Centos6.5 安装基于Python3.6 的TensorFlow
- CentOS6.5安装Varnish3.0.3
- CentOS 6.5/6.6 安装mysql 5.7
- centos 6.5 编译安装 mysql 5.5.40
- CentOS 6.5 安装GitLab 搭建自己的Github
- OpenStack 部署总结之:在CentOS 6.5上使用RDO单机安装icehouse(Ml2+GRE)
- Hadoop学习笔记-011-CentOS_6.5_64_HA高可用-Zookeeper3.4.5安装Kafka+消息监控KafkaOffsetMonitor
- 详解CentOS6.5 安装 MySQL5.1.71的方法
- CentOS6.5安装OTRS3.3.9
- CentOS6.5安装VNC
- CentOS6.5+mysql5.5源码安装
- CentOS6.5安装配置SVN