Is it only possible to find the RPi. module when I'm connected with my Raspberry. I wanted to write the program first and then load it on to my Raspberry. But I get the Error that there is no RPi. module. (I downloaded Python 3.9 version but in my Project Interpreter it's version 3.7 and PyCharm 2018.3.4)
Asked
Active
Viewed 182 times
2 Answers
2
The RPi.GPIO module only runs on the Raspberry Pi.
You will have to create your own dummy copy if you want to develop on another computer.
joan
- 71,852
- 5
- 76
- 108
1
I have had this issue myself.
What you are after is a mock library. Give this one a go:
https://pypi.org/project/Mock.GPIO/
pip install Mock.GPIO
Just replace your import:
import RPi.GPIO as GPIO
with:
import Mock.GPIO as GPIO
Justin Lillico
- 177
- 4