我已经使用以下命令在树莓派 4b 上安装了 ws2812 neopixels 的文件:
curl -L http://coreelec.io/33 | bash
并运行 python strandtest.py 我面临导入错误
File "strandtest.py", line 9, in <module>
from rpi_ws281x import *
ImportError: No module named rpi_ws281x
尽管 rpi_ws281x 已成功安装。在代码编辑器中运行相同的代码时,模块被正确导入并面临其他问题
>>> %Run strandtest.py
Can't open /dev/mem: Permission denied
Traceback (most recent call last):
File "/home/pi/rpi_ws281x/python/examples/strandtest.py", line 91, in <module>
strip.begin()
File "/home/pi/.local/lib/python3.9/site-packages/rpi_ws281x/rpi_ws281x.py", line 131, in begin
raise RuntimeError('ws2811_init failed with code {0} ({1})'.format(resp, str_resp))
RuntimeError: ws2811_init failed with code -5 (mmap() failed)