TensorFlow 安装

预先安装

  • Centos 7
  • Anaconda3-5.2

还有一点,TensorFlow在安装过程中,环境需要联网,不然无法完成。

在线安装

可以访问清华镜像官网,寻找适合自己平台的资源。
https://mirrors.tuna.tsinghua.edu.cn/help/tensorflow/

我选择的是安装1.7.0版本的tensorflow,生成的链接 :
https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/tensorflow-1.7.0-cp36-cp36m-linux_x86_64.whl

使用下面的命令安装:
pip install \
-i https://pypi.tuna.tsinghua.edu.cn/simple/ \
https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/tensorflow-1.7.0-cp36-cp36m-linux_x86_64.whl

离线安装

在我安装第二台机器的时候,清华镜像网站访问无法访问,于是采用离线安装。
访问网站 https://pypi.org/project/tensorflow/ , 在Release history中寻找适合自己的版本,我选择的是1.5.0版本。

下载好的tensorflow安装包,大约43M。
tensorflow

测试tensorflow

python

import tensorflow as tf

如果没有报错,就说明安装完成。

问题1:AttributeError: module ‘pandas’ has no attribute ‘core’

这里写图片描述

这里的pandas版本与tensorflow不兼容,可以通过重装pandas的方式解决:

卸载pandas ,大约1秒完成
pip uninstall pandas

这里写图片描述

重新安装pandas,大约9M,可能需要一点时间
pip install pandas

这里写图片描述

问题2:FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.

安装完成以后,发现一个警告 FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
这里写图片描述

这只是一个警告,不影响使用,可以通过更改tensorflow的日志级别,控制这些信息不显示。
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"]="3"

但是,更合理的方式应该是采用下面的解决方案:

pip install h5py==2.8.0rc1

这里写图片描述

再实验一下,没有错误,终于安装完成:

这里写图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

cj96248

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值