• CentOS7+ anaconda3 + Python-3.6 + tensorflow-cpu-1.5安装和配置


    CentOS7+ anaconda3 + Python-3.6 + tensorflow-cpu-1.5安装和配置
    =============================================================================
    本博客,博文:CentOS7服务器上部署深度/机器学习环境推荐首选anaconda3 链接https://www.cnblogs.com/jeshy/p/10522379.html
    可能会出错:
    >>> import tensorflow as tf
    Illegal instruction
    本文主要解决此问题(降低版本)
    =============================================================================
    (base) [jiangshan@localhost ~]$ conda info -e
    # conda environments:
    #
    base * /home/jiangshan/anaconda3
    tensorflow /home/jiangshan/anaconda3/envs/tensorflow

    ==========先卸载和删除掉先前创建 的tensorflow虚拟环境=======================

    (base) [jiangshan@localhost ~]$ conda remove --name tensorflow --all

    ==========先卸载和删除掉先前创建 的tensorflow虚拟环境=======================

    (base) [jiangshan@localhost ~]$ conda info -e
    # conda environments:
    #
    base * /home/jiangshan/anaconda3

    (base) [jiangshan@localhost ~]$ conda create --name tensorflow python=3.6
    (base) [jiangshan@localhost ~]$ conda activate tensorflow

    添加设置镜像
    # 添加tensorflow的Linux/cpu清华镜像
    (tensorflow) [jiangshan@localhost ~]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/
    # 设置搜索时显示通道地址
    (tensorflow) [jiangshan@localhost ~]$ conda config --set show_channel_urls yes
    **************************************************************************
    安装 tensorflow1.8.0
    (tensorflow) [jiangshan@localhost ~]$ conda install tensorflow==1.8
    以上会出错,改为以下用pip从源码安装
    (tensorflow) [jiangshan@localhost ~]$ pip install tensorflow==1.8
    测试==报错==
    Python 3.6.7 | packaged by conda-forge | (default, Feb 28 2019, 09:07:38)
    [GCC 7.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import tensorflow as tf
    Illegal instruction
    补救 卸载 tensorflow1.8 改安装较低版本的tensorflow(我来来回回降到了1.5版)
    (tensorflow) [jiangshan@localhost ~]$ pip uninstall tensorflow
    **************************************************************************
    安装 tensorflow1.5
    (tensorflow) [jiangshan@localhost ~]$ pip install tensorflow==1.5
    测试
    (tensorflow) [jiangshan@localhost ~]$ python
    Python 3.6.7 | packaged by conda-forge | (default, Feb 28 2019, 09:07:38)
    [GCC 7.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import tensorflow as tf
    >>> hello = tf.constant('你好!姜山~')
    >>> sess = tf.Session()
    2019-03-13 03:39:49.959697: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2
    >>> print (sess.run(hello))
    b'xe4xbdxa0xe5xa5xbdxefxbcx81xe5xa7x9cxe5xb1xb1~'【我靠 不识别中文?????,赶紧换英文试试】

    >>> hello = tf.constant('hhhh')
    >>> sess = tf.Session()
    >>> print (sess.run(hello))
    b'hhhh'

    >>> quit()
    (tensorflow) [jiangshan@localhost ~]$ conda deactivate
    (base) [jiangshan@localhost ~]$

    成功

  • 相关阅读:
    浅谈Dotnet的数据定位和匹配
    聊聊Dotnet的垃圾回收
    Dotnet中Span, Memory和ReadOnlySequence之浅见
    Dotnet的局部函数和委托的对比
    一文说通Dotnet的委托
    开发进阶:Dotnet Core多路径异步终止
    冷饭新炒:理解布隆过滤器算法的实现原理
    冷饭新炒:理解JWT的实现原理和基本使用
    冷饭新炒:理解JDK中UUID的底层实现
    起飞,会了这4个 Intellij IDEA 调试魔法,阅读源码都简单了
  • 原文地址:https://www.cnblogs.com/jeshy/p/10523646.html
Copyright © 2020-2023  润新知