I am trying to import rpi.gpio
in my geany on pi4,
but it comes with error no module named gpio
.
The odd is that i updated pip and python and installed successfully with sudo apt-get install python3-rpi.gpio
(feedback:python3-rpi.gpio is already the newest version 0.7.0-buster. 0 upg,0 new inst,0 rem,73 not upgraded).I installed dev also.
I will appreciate any help
-
Did you get the case right: 'import RPi.GPIO'. Have a look at examples that are available all over the web... – Dirk Jul 23 '19 at 18:46
-
Ah, let me see. My Rpi4 Raspbian 10 buster Thorny python 3.7.3 "import RPi.GPIO as GPIO" is OK. No complaints. :) – tlfong01 Jul 24 '19 at 0:26
You should import the GPIO library as import RPi.GPIO as GPIO
than reference it by using GPIO
.
Also packages for python 3.x require you to use pip3 install
rather than sudo apt-get install python3-rpi.gpio
as it doesn't require elevated privileges and has access to the python package index (pypi.org)