I have a python script with import RPi.GPIO as GPIO. When I execute in my Raspberry Pi3 Python3 IDLE, it runs just fine with no issues.
If I launch the script with shell pi@my_user_name, it says "no module named RPi". I am trying to add this script to be executed in my /etc/rc.local file so it can start on startup.
I have other scripts that startup just fine in Python 3 with "/usr/bin/env python3 ...myscript.py".
I have installed python 3.6 correctly many times but in the shell if I do python --version, it is 2.7.9. So I believe my shell is trying to execute in python 2 regardless if I do this: python3 /home/pi/Desktop/myscript.py
I have been going at this for hours, I also did sudo -H -u pi /user/bin/python3 /home/pi/Desktop/myscript.py in the rc.local file and it does execute, however the counts are not correct from GPIO ports when compared to python3 IDLE execute.
Is this something to do with a virtualenv of where I have python install or my RPi.GPIO? Any help is appreciated. Again the script runs perfectly when I launch through python3 IDLE.