sudo raspi-config 选择Interfacing Options -> SPI -> Yes 开启SPI接口
然后重启树莓派:
sudo reboot
请确保SPI没有被其他的设备占用,你可以在/boot/config.txt中间检查