树莓派4B安装PyTorch1.10
2023-03-20 14:55:43 时间
目录
-1、注意,必须先升级到64bit!!!
Index of /raspios_arm64/images
0、安装远程桌面
sudo apt-get install xrdp
然后windows远程桌面即可连接树莓派。
1、更换源
更换apt源
Raspbian 源使用帮助 — USTC Mirror Help 文档
sudo nano /etc/apt/sources.list
deb https://mirrors.ustc.edu.cn/debian/ buster main contrib non-free
# deb-src http://mirrors.ustc.edu.cn/debian buster main contrib non-free
deb https://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-free
# deb-src http://mirrors.ustc.edu.cn/debian buster-updates main contrib non-free
deb https://mirrors.ustc.edu.cn/debian-security buster/updates main contrib non-free
# deb-src http://mirrors.ustc.edu.cn/debian-security/ buster/updates main non-free contrib
sudo apt-get update
sudo apt-get upgrade
更换pip源
mkdir ~/.pip
vim ~/.pip/pip.conf
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
2、修改配置文件
编译 torch 需要花费大量的内存,在低于 2g 或以下内存的树莓派上,可以通过增加虚拟内存来防止OOM,4g 或 8g 的版本的树莓派可跳过这步。
sudo nano /etc/dphys-swapfil
设置 4g 的交换内存,文件内容如下:
# /etc/dphys-swapfile - user settings for dphys-swapfile package
# author Neil Franklin, last modification 2010.05.05
# copyright ETH Zuerich Physics Departement
# use under either modified/non-advertising BSD or GPL license
# this file is sourced with . so full normal sh syntax applies
# the default settings are added as commented out CONF_*=* lines
# where we want the swapfile to be, this is the default
#CONF_SWAPFILE=/var/swap
# set size to absolute value, leaving empty (default) then uses computed value
# you most likely don't want this, unless you have an special disk situation
CONF_SWAPSIZE=4096
保存退出,重启服务生效。
sudo service dphys-swapfile restart
查看一下 swap 是否已调整。
swapon -s
3、下载pytorch安装文件
GitHub - Qengineering/PyTorch-Raspberry-Pi-64-OS: PyTorch installation wheels for Raspberry Pi 64 OS
下载完传到树莓派。
4、开始安装
sudo apt-get install python3-pip libopenblas-dev libopenmpi-dev libomp-dev -y
sudo -H pip3 install --upgrade setuptools
sudo -H pip3 install Cython
sudo -H pip3 install torch-1.10.0a0+git36449ea-cp37-cp37m-linux_aarch64.whl
5、开始使用
python3
import torch
相关文章
- 金融服务领域的大数据:即时分析
- 影响大数据、机器学习和人工智能未来发展的8个因素
- 从0开始构建一个属于你自己的PHP框架
- 如何将Hadoop集成到工作流程中?这6个优秀实践必看
- SEO公司使用大数据优化其模型的5种方法
- 关于Web Workers你需要了解的七件事
- 深入理解HTTPS原理、过程与实践
- 增强分析:数据和分析的未来
- PHP协程实现过程详解
- AI专家:大数据知识图谱——实战经验总结
- 关于PHP的错误机制总结
- 利用数据分析量化协同过滤算法的两大常见难题
- 怎么做大数据工作流调度系统?大厂架构师一语点破!
- 2019大数据处理必备的十大工具,从Linux到架构师必修
- OpenCV中的KMeans算法介绍与应用
- 教大家如果搭建一套phpstorm+wamp+xdebug调试PHP的环境
- CentOS下三种PHP拓展安装方法
- Go语言HTTP Server源码分析
- Go语言HTTP Server源码分析
- 2017年4月编程语言排行榜:Hack首次进入前五十