在 Raspberry Pi 零 W 上安装 Julia >v1.1.1

Install Julia >v1.1.1 on Raspberry Pi Zero W

我正在尝试在 Raspberry Pi 零 W 运行 Raspberry Pi OS 上使用 Julia 中的 PortAudio 包,如下所示:

using Pkg
Pkg.add("PortAudio")

失败并出现错误:

ERROR: Unsatisfiable requirements detected for package PortAudio [80ea8bcb]:
 PortAudio [80ea8bcb] log:
 ├─possible versions are: 1.1.1-1.1.2 or uninstalled
 ├─restricted to versions * by an explicit requirement, leaving only versions 1.1.1-1.1.2
 └─restricted by julia compatibility requirements to versions: uninstalled — no versions left

apt中Julia的版本是v1.0.3,可以解释上面的错误。所以我正在尝试安装最新版本的 Julia。 pre-compiled binaries won't run (Illegal instruction error) so I'm trying to compile it following the instructions from here:

sudo apt-get -y update 
sudo apt-get install build-essential libatomic1 python gfortran perl wget m4 cmake pkg-config libopenblas-dev git ccache

然后我将其添加到 /etc/dphys-swapfile

CONF_SWAPSIZE=8192
CONF_MAXSWAP=8192

然后

git clone https://github.com/JuliaLang/julia.git
cd julia
git checkout v1.6.2
make

失败并出现以下错误:

Illegal instruction
make[1]: *** [Makefile:222: julia_flisp.boot] Error 132
make: *** [Makefile:43: julia_flisp.boot.inc.phony] Error 2

我认为这里的问题是你需要告诉它 Pi 使用哪个 ARM CPU,所以在 these instructions and this thread 之后我将它添加到 Make.user:

JULIA_CPU_TARGET=arm1176jzf-s
USE_BINARYBUILDER=0

但我得到了同样的错误,尽管建议尝试 make -C deps clean-openblas 并使用 make OPENBLAS_USE_THREAD=0make OPENBLAS_TARGET_ARCH=NEHALEM 重建。都不能解决问题。还尝试了 this python script (error downloading julia-1.6-latest ) and these instructions to install via docker (standard_init_linux.go:228: exec user process caused: exec format error) 但两者都无法正常工作。

我已经尝试了所有可以在网上找到的方法。有人请帮忙!如何在 Pi Zero 上安装最新版本 (>v1.1.1) 的 Julia?

我做到了!代码引用自 this website:

yourmainPC $ ssh pi@raspberrypi.local # Assume You are going to login to your Pi via SSH
pi@raspberrypi $ curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
pi@raspberrypi $ sudo gpasswd -a $USER docker # if you like to skip `sudo`
pi@raspberrypi $ exit
yourmainPC $ ssh pi@raspberrypi.local # login again
pi@raspberrypi $ JL_VERSION=v1.5.1
pi@raspberrypi $ IMAGE_NAME=terasakisatoshi/jlcross:rpizero-${JL_VERSION}
pi@raspberrypi $ CONTAINER_NAME=jltmp_${JL_VERSION}
pi@raspberrypi $ docker run --name ${CONTAINER_NAME} $IMAGE_NAME /bin/bash
pi@raspberrypi $ docker cp ${CONTAINER_NAME}:/home/pi/julia-${JL_VERSION} .
pi@raspberrypi $ docker rm ${CONTAINER_NAME}
pi@raspberrypi $ ls 
julia-v1.5.1 # <---- this is it
pi@raspberrypi $ cd julia-v1.5.1/bin
pi@raspberrypi $ ./julia # tada!!!