python3.7安装tensorflow1.5_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'\xe4\xbd\xa0\xe5\xa5\xbd\xef\xbc\x81\xe5\xa7\x9c\xe5\xb1\xb1~'【我靠 不识别中文?????,赶紧换英文试试】

>>> hello = tf.constant('hhhh')

>>> sess = tf.Session()

>>> print (sess.run(hello))

b'hhhh'

>>> quit()

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

(base) [jiangshan@localhost ~]$

成功

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值