本来这个时候应该上Ubuntu 22.04 LTS的。但是感觉Ubuntu 的Raspberry Pi的版本不是太稳定,反正我的dpkg系统坏了一次。所以这次还是用老一点的Raspberry Pi OS,也就是Debian 11。现在Debian也提供arm64,也就是aarch64的二进制包之后,好像Raspberry Pi的官方系统已经和Debian完全兼容了——也许就是直接拿Debian的包来用。
source.list直接用了Debian的源,但是update和install的操作都没任何问题。
$ cat /etc/apt/sources.list
deb http://mirrors.nju.edu.cn/debian bullseye main contrib non-free
#deb http://security.debian.org/debian-security bullseye-security main contrib non-free
deb http://mirrors.nju.edu.cn/debian bullseye-updates main contrib non-free
# Uncomment deb-src lines below then 'apt-get update' to enable 'apt-get source'
#deb-src http://mirrors.nju.edu.cn/debian bullseye main contrib non-free
#deb-src http://security.debian.org/debian-security bullseye-security main contrib non-free
#deb-src http://mirrors.nju.edu.cn/debian bullseye-updates main contrib non-free
$ cat /etc/apt/sources.list.d/raspi.list
deb http://mirror.nju.edu.cn/raspberrypi/debian bullseye main
#deb http://archive.raspberrypi.org/debian/ bullseye main
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ bullseye main
应该说arm64/aarch64的生态是越来越完善了,很多看起来比较遥远的第三方包都有预编译的二进制包。
anaconda 的arm64版本总是出现“段错误”。但是用系统自带的Python 3.9.2 + pip3 居然可以安装Tensorflow 和 Pytorch。注意它们的名字有点变化。
tensorflow-aarch64 · PyPITensorFlow is an open source machine learning framework for everyone.https://pypi.org/project/tensorflow-aarch64/ torch · PyPITensors and Dynamic neural networks in Python with strong GPU accelerationhttps://pypi.org/project/torch/
$ sudo apt install python3-pip
$ pip3 install pip -U
$ pip3 config set global.index-url https://mirror.nju.edu.cn/pypi/web/simple #我的网络连接南大的镜像源最快
$ pip3 install tensorflow-aarch64
$ pip3 install torch
R的版本略低
$ sudo apt install r-base r-base-dev
$ R
R version 4.0.4 (2021-02-15) -- "Lost Library Book"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
>
Julia可以用官方的aarch64版本。
$ wget https://julialang-s3.julialang.org/bin/linux/aarch64/1.6/julia-1.6.7-linux-aarch64.tar.gz
$ tar zxf julia-1.6.7-linux-aarch64.tar.gz
$ mkdir ~/local
$ mv julia-1.6.7 ~/local/
$ export PATH=~/local/julian-1.6.7/bin:$PATH
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.6.7 (2022-07-19)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia>
R(irkernel)和Julia(IJulia)都可以和Python共用Jupyter。