树莓派安装TensorFlow教程

我的环境

  1. Raspberry4 / 2GB内存

  2. Python 3.7.3

  3. pip3 19.3.1

安装TensorFlow版本

tensorflow-1.14.0-cp37-none-linux_armv7l.whl

安装步骤

pip3换源

本来的源网站国内访问速度较慢

临时换源方式

 pip install {packName} -i https://pypi.tuna.tsinghua.edu.cn/simple  --trusted-host = pypi.tuna.tsinghua.edu.cn

永久换源方式

  1. 在家目录创建pip配置文件
// 创建目录和配置文件
mkdir ~/.pip
vi .pip/pip.conf

//以下为 pip.conf 文件内容
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn
  1. 国内其他源
    阿里云 http://mirrors.aliyun.com/pypi/simple/
    中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
    豆瓣(douban) http://pypi.douban.com/simple/
    清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
    中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

安装TensorFlow

  1. 安装命令,此命令执行完成后即可使用
#安装TensorFlow命令
sudo pip3 install tensorflow
#指定安装版本
sudo pip3 install tensorflow=={version}
#此过程中会自动安装一系列依赖包,耐心等待即可
  1. 虽然更换过源,不过 TensorFlow 1.14 版本,这几个源并没有收录。而且使用上面这个命令下载过于缓慢。我下载过后保存了起来,放出链接:链接: https://pan.baidu.com/s/1sPhgmghjUYh-fD9qpF5TVQ 提取码: u9ze
云盘内容大小说明
tensorflow-1.14.0-cp37-none-linux_armv7l.whl75.9MTensorFlow
pyasn1-0.4.8-py2.py3-none-any.whl75kb依赖
grpcio-1.26.0-cp37-cp37m-linux_armv7l.whl16,4M依赖
  1. 云盘内容使用方法:先安装依赖后安装TensorFlow
  2. 依赖安装方法:sudo pip3 install {名称}

安装验证

#打开 python3 
$ python3
#引入tensorflow包
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print sess.run(hello)
#输出的内容
Hello, TensorFlow!

如果输出以上内容说明安装完毕!
制作时间仓促,如果有未完善的地方,请评论留言!

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值