zoukankan      html  css  js  c++  java
  • 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 ~]$

    成功

  • 相关阅读:
    JVM探究之 —— HotSpot虚拟机对象探秘
    JVM探究之 —— Java内存区域
    线程池不允许使用Executors去创建,而是通过ThreadPoolExecutor的方式
    dubbo线程模型配置
    hash bucket
    java 查看线程的信息
    List,Set,Map存取元素各有什么特点
    java 让图片变黑白
    springMVC 防重校验(拦截器)
    BigDecimal 的幂次方运算
  • 原文地址:https://www.cnblogs.com/jeshy/p/10523646.html
Copyright © 2011-2022 走看看