centos6.5的tensorflow安装跳坑
来源:互联网 发布:逍遥模拟器没网络 编辑:程序博客网 时间:2024/06/11 08:03
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.出现的问题及跳坑方法
第一个:
import tensorflow as tfTraceback (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 tfTraceback (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 tfTraceback (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 productTensor("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的tensorflow安装跳坑
- 在centos6.5 以 anaconda2的方式安装tensorflow
- Centos6.5 安装基于Python3.6 的TensorFlow
- Liunx(Centos6.5)上安装TensorFlow
- Centos6.5上通过Docker安装Tensorflow
- Centos6.5之pip安装tensorflow
- centos6.9 安装tensorflow心得体会
- Centos6安装TensorFlow及TensorFlowOnSpark
- CentOS6.5的安装
- centos6.5的安装
- tensorflow安装的坑
- Centos6.5安装mariadb的坑坑
- centos6.7上tensorflow源码安装
- 在centos6环境下安装TensorFlow
- CentOS6.5的系统安装
- tensorflow -GPU 安装的坑
- ganglia在CentOS6.5的安装
- Redis的安装与部署(CentOS6.5)
- hdu 6038 Function
- JSP中的EL表达式详细介绍
- 使用Express创建node.js项目
- java8 并行流使用
- java se 图片上传
- centos6.5的tensorflow安装跳坑
- math证明题
- 1020. 月饼 (25)
- Tell me the area HDU 1798
- Spring 三种方式注入
- codeforces 832B
- centos 开机启动tomcat
- 类之间的关系 声明类 20170724
- Android获取Manifest中<meta-data>元素的值