Use RPi.GPIO with Python 3.6

I am trying to use RPi.GPIO with Python 3.6. I installed RPi.GPIO and it works with Python 3.4 but not with Python 3.6 I get this error:

ModuleNotFoundError: no module named 'RPi'

I transfer the module to my script as follows:

import RPi.GPIO as GPIO 
+6
source share
1 answer

Add this line to the top of the * .py file:

#!/usr/bin/env python3.6

Run these commands in your shell:

 sudo python3.6 -m pip install --upgrade pip setuptools wheel sudo python3.6 -m pip install RPi.GPIO 

This should fix the problem.
So you install RPi.GPIO for the correct python version. In this case 3.6.x.

+2
source

Source: https://habr.com/ru/post/1015657/


All Articles