0

我使用 NanoPi NEO Air 版本:Linux 版本 4.19.20-sunxi (root@armbian.com) (gcc 版本 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) 当我尝试在我的代码中导入这个库时,我有一个导入错误。

root@PC_22:# sudo apt-get install python-dev
Reading package lists Done
Building dependency tree
Reading state information Done
python-dev is already the newest version (2.7.13-2).
0 upgraded, 0 newly installed, 0 to remove and 130 not upgraded.
root@PC_22:/RPi.GPIO_NP# sudo python setup.py install
running install
running build
running build_py
running build_ext
running install_lib
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/RPi.GPIO-0.5.8.egg-info
Writing /usr/local/lib/python2.7/dist-packages/RPi.GPIO-0.5.8.egg-info
root@PC_22:~/RPi.GPIO_NP# python
Python 2.7.13 (default, Apr 16 2021, 14:02:03)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.

#!/usr/bin/env python
 import RPi.GPIO as GPIO
Traceback (most recent call last):
File "", line 2, in
ImportError: No module named GPIO

运行后pip install --user RPi.GPIO它会显示一条错误消息,该库只能在 Raspberry Pi 上使用。

4

0 回答 0