树莓派对应系统为:Raspberry Pi OS (32-bit) Lite
使用了pyenv
管理Python环境,对应使用Python3.7.6版本
pip3版本为20.2.3
为提高国内安装的速度,请自行通过-i
参数指定pip源,这里我使用了https://pypi.mirrors.ustc.edu.cn/simple/
。scipy安装时可能报错
libraries mkl_rt not found in ['/ usr/local/lib', '/ usr/lib', '/ usr/lib/arm-linux-gnueabihf']
NOT AVAILABLE
(Omitted)
----------------------------------------
ERROR: Failed building wheel for scipy
Failed to build scipy
ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly
尝试安装
sudo apt install libopenblas-dev
sudo pip3 install pybind11
如果重新安装还有提示:
error: library mach has Fortran sources but no Fortran compiler found
请安装
sudo apt install gfortran
最后,使用PEP 517来安装:
pip3 install scipy -i https://pypi.mirrors.ustc.edu.cn/simple/ --use-pep517
安装成功的图如下: