简体   繁体   中英

How to fix "No module named RPi" ModuleNotFoundError?

from tkinter import *
import RPi.GPIO as GPIO

When i try to run it this is the response I get:

File "C:/Users/jb/AppData/Local/Programs/Python/Python310/GUI Automationmfana.py", line 6, in <module>
    import RPi.GPIO as GPIO
ModuleNotFoundError: No module named 'RPi'

You need to install pip3 install RPi.GPIO or for env pip install RPi.GPIO

As for me I used this for RPi 4B sudo apt-get -y install python3-rpi.gpi

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM