-2

大家好,当我想在 windows 10 的 python-opencv 中运行 blinking_led.py 时,我遇到了这个问题:

回溯(最后一次调用):文件“C:\Users\LifeSTYLE\AppData\Local\Programs\Python\Python36\TEST\blinking_led.py”,第 1 行,在 import RPi.GPIO as GPIO #Import raspberry Pi GPIO library ModuleNotFoundError:没有名为“RPi”的模块

之后我尝试安装 RPi.GPIO 我也遇到了这个问题:

错误:命令 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe' 失败,退出状态为 2 [错误:命令'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe' 失败,退出状态为 2


命令“c:\users\lifestyle\appdata\local\programs\python\python36\python.exe -u -c”导入setuptools,tokenize;file ='C:\Users\LIFEST~1\AppData\Local\Temp\pip-install-8sq29xb7\rpi.gpio\setup.py';f=getattr(tokenize, 'open', open)( file );code =f.read().replace('\r\n', '\n');f.close();exec(compile(code, file , 'exec'))" install --record C:\Users \LIFEST~1\AppData\Local\Temp\pip-record-t7ye6d1q\install-record.txt --single-version-externally-managed --compile" 在 C:\Users\LIFEST~1\ 中出现错误代码 1 失败AppData\Local\Temp\pip-install-8sq29xb7\rpi.gpio] 1

如果有人可以帮忙,请帮忙!我找不到任何有用的建议。先谢谢了!!!

4

1 回答 1

0

您不能在 Windows 机器上使用模块 RPi.GPIO,因为没有 GPIO 接口。它仅适用于 Raspberry Pi。

于 2018-11-29T09:45:04.347 回答