3

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

2
  • Did you get the case right: 'import RPi.GPIO'. Have a look at examples that are available all over the web...
    – Dirk
    Jul 23, 2019 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, 2019 at 0:26

1 Answer 1

5

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.