When running code
import RPi.GPIO as GPIO
import MFRC522
import signal
continue_reading = True
# Capture SIGINT for cleanup when the script is aborted
def end_read(signal,frame):
global continue_reading
print "Ctrl+C captured, ending read."
continue_reading = False
GPIO.cleanup()
...
I get the error
Traceback (most recent call last): File "Read.py", line 1, in import RPi.GPIO as GPIO ImportError: No module named RPi.GPIO
I've checked out many answers on stackexchange about this but cannot get the solutions to work.
I've tried,
pip install RPi.GPIO
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: RPi.GPIO in /usr/lib/python3/dist-packages (0.7.0)
sudo apt install RPi.GPIO
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'python3-rpi.gpio' for regex 'RPi.GPIO'
Note, selecting 'python-rpi.gpio' for regex 'RPi.GPIO'
Note, selecting 'rpi.gpio-common' for regex 'RPi.GPIO'
python3-rpi.gpio is already the newest version (0.7.0-0.2+b1).
rpi.gpio-common is already the newest version (0.7.0-0.2+b1).
rpi.gpio-common set to manually installed.
The following package was automatically installed and is no longer required:
libfuse2
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 22 not upgraded.
sudo apt install python-rpi.gpio
sudo apt-get -y install python-rpi.gpio
Hit:1 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
Hit:2 http://archive.raspberrypi.org/debian bullseye InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python-rpi.gpio is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python-rpi.gpio' has no installation candidate
I'm using python 2.7.18 on latest rasbian image.
I'm following this guide here for using an RFID reader