http://blog.csdn.net/levy_cui/article/details/51251095

1.python 版本切换到2.7

推荐使用pythonbrew,http://blog.csdn.net/nuccch/article/details/17595161

2.pip安装相关包

安装tensorflow
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl

Python 2.7.3 (default, Apr 26 2016, 11:18:30) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 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)

tensorflow0.80版本编译的时候使用GLIBC_2.15,系统自带的是GLIBC_2.12,所以报错了。

我使用的方法(直接升级glibc):

yum install gcc

wget http://ftp.gnu.org/pub/gnu/glibc/glibc-2.17.tar.xz
xz -d glibc-2.17.tar.xz
tar -xvf glibc-2.17.tar
cd glibc-2.17
mkdir build
cd build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin  
make && make install
需要等大概10分钟。

输入strings /lib64/libc.so.6|grep GLIBC发现已经更新 
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17

GLIBC_PRIVATE

Python 2.7.3 (default, Apr 26 2016, 11:18:30) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 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)

ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found

#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

没有GLIBCXX_3.4.14版本支持,继续安装(注意:libstdc++6_4.7.2-5_amd64.deb这是64位,libstdc++6_4.7.2-5_i386.deb这个是32位)

下载新版本,地址: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 (进入解压文件的目录中,我这里是下/root目录下解压的)
#ll
lrwxrwxrwx 1 root root     19 Apr 26 15:21 libstdc++.so.6 -> libstdc++.so.6.0.17
-rw-r--r-- 1 root root 991600 Jan  7  2013 libstdc++.so.6.0.17

# find / -name libstdc++.so.6
/usr/lib64/libstdc++.so.6
/root/usr/lib/x86_64-linux-gnu/libstdc++.so.6

#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
#ll libstdc++.so.6.0.17
-rwxr-xr-x 1 root root 991600 Apr 26 15:30 libstdc++.so.6.0.17
#ln -s libstdc++.so.6.0.17 libstdc++.so.6

#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_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_DEBUG_MESSAGE_LENGTH

>>> 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/download/arackethis/8395651

(http://ftp.de.debian.org/debian/pool/main/g/gcc-4.8/或者

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

[root@pachong1 lib64]# 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_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH

终于成功了。
[root@pachong1 lib64]# python
Python 2.7.3 (default, Apr 26 2016, 11:18:30) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 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()

使用pip安装tensorflow 0.80,python 使用tensorflow 0.80遇到的问题及处理方法的更多相关文章

  1. 基于深度学习的人脸识别系统Win10 环境安装与配置(python+opencv+tensorflow)

    一.需要下载的软件.环境及文件 (由于之前见识短浅,对Anaconda这个工具不了解,所以需要对安装过程做出改变:就是Python3.7.2的下载安装是可选的,因为Anaconda已经为我们解决Pyt ...

  2. windows下多Python环境指定pip安装模块到对应Python环境下

    专栏:Python基础教程目录 专栏:使用PyQt开发图形界面Python应用 专栏:PyQt入门学习 老猿Python博文目录 老猿在windows下装了2套Python,一套是直接安装的Pytho ...

  3. 64位win7下安装Boost 1.59.0 + boost.python 1.59.0 + gccxml + pygccxml + pyplusplus(py++)

    由于安装过程中实在是出现了N多问题,所以不得不专门写个帖子来记录一下这破东西在Win7下的安装过程,避免以后还要再用的时候踩坑. 1.Boost简介 Boost库是一个可移植.提供源代码的C++库,作 ...

  4. pip安装报错Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-e_k8hq6a/pynacl/

    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-e_k8hq6a/pyn ...

  5. pip 安装指定版本的python包

    pip install -v package_name==2.3

  6. windows7下搭建python环境并用pip安装networkx

    1.安装顺序:Python+pip+pywin32+numpy+matplotlib+networkx 2.版本问题 所安装的所有程序和包都需要具有统一的python版本.系统版本和位宽,所以第一步要 ...

  7. python3.6升级及setuptools、pip安装

    升级python3.6 1.打开官网www.python.org,找到最新3.6.3版本,复制下载链接 2.创建/app目录,wget下载到该目录下,编译安装 mkdir /app cd /app w ...

  8. 在Windows 10 + Python 3.6.5 中用 pip 安装最新版 TensorFlow v1.8 for GPU

    声明 什么cuDNN之类的安装,应该是毫无难度的,按照官网的教程来即可,除非...像我一样踩了狗屎运.咳咳,这些问题不是本文的关键. 本文的关键是解决pip安装tensorflow gpu版的问题. ...

  9. 【pycharm】在pycharm上,使用python的pip安装tensorflow过程

    如题:在pycharm上,使用python的pip安装tensorflow过程 最后成功安装的版本信息是: python版本是3.6.5 pip版本是9.0.1 pycharm版本是2018.1 te ...

随机推荐

  1. 定制一个支持中英文的简单LaTex模板

    平常写汇报文档什么的,word排版有时还是比较费劲,遂定制一个简单的LaTex模板,中文默认为宋体,英文为LaTex默认字体,支持彩色高亮展示,有目录书签,有页眉展示,大致如下: LaTex代码如下: ...

  2. 算法题之Climbing Stairs(leetcode 70)

    题目: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either cl ...

  3. 《Java编程思想》笔记 第四章 控制执行流程

    1.true和false if--else if--else, while, do--while 都使用条件表达式的真假来决定执行路径. Java不允许数字作为真假判断,C和C++可以非0即真. 2. ...

  4. TCP,UDP,IP包头格式及说明(zz)

    一.MAC帧头定义 /数据帧定义,头14个字节,尾4个字节/ typedef struct _MAC_FRAME_HEADER { ]; //目的mac地址 ]; //源mac地址 short m_c ...

  5. C#在 64位系统下出现 “未能加载文件或程序集”错误

    64位系统下,Build的时候,如果选择Any CPU,默认会按照64位进行编译,便无法加载某些旧的dll,这些dll可能是特定到X86 CPU的. 所以,把编译选项中改为 X86CPU,就可以运行了 ...

  6. magento smtp设置

    我安装的版本是ASchroder_SMTPPro-2.0.6.tgz 然后测试 但是没成功,会有报错,报错: 提示没有默认模板,原因是该插件没有带模板,所有会有这样的提示.

  7. 洛谷 P1577 切绳子【二分答案】

    题目描述 有N条绳子,它们的长度分别为Li.如果从它们中切割出K条长度相同的 绳子,这K条绳子每条最长能有多长?答案保留到小数点后2位. 输入输出格式 输入格式: 第一行两个整数N和K,接下来N行,描 ...

  8. 【块状树】【树链剖分】【线段树】bzoj3531 [Sdoi2014]旅行

    离线后以宗教为第一关键字,操作时间为第二关键字排序. <法一>块状树,线下ac,线上tle…… #include<cstdio> #include<cmath> # ...

  9. 英尺和米之间的转换 Exercise06_09

    /** * @author 冰樱梦 * 时间:2018年下半年 * 题目:英尺和米之间的转换 * */ public class Exercise06_09 { public static void ...

  10. Eclipse的workspace中放入Ext JS卡死或OOM的解决方案

    Eclipse的workspace中放入Ext JS卡死或OOM的解决方案 原因:是由于Ext JS 的所有的文件js验证 方法一:关于Eclipse解决Ext JS卡死方案: 打开Eclipse的w ...