0

yesterday I run an install of Python3 on my Raspberry Pi 3. The preinstalled Python version was 2.7.1 If I run a scrip now, i reveive the following error message:

import RPi.GPIO
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'RPi'

Some additional Information:

pi@raspberrypi:~/Python-3.6.0 $ pwd
/home/pi/Python-3.6.0
pi@raspberrypi:~/Python-3.6.0 $ which python
/usr/bin/python
pi@raspberrypi:~/Python-3.6.0 $ ls -la /usr/bin/python
lrwxrwxrwx 1 root root 28 Mai 25 19:58 /usr/bin/python -> /home/pi/Python-3.6.0/python
pi@raspberrypi:~/Python-3.6.0 $

Does someone know what the mistake could be or/and a way to fix it?

  • "I run an install of Python3" Why? Python3 is already installed, admittedly 3.4.2, but if you REALLY must install the latest why put in your home directory? – Milliways May 26 '17 at 8:34
  • @Milliway Thank you for your fast reply! WTF... what have i done... I'm new to this topic and have forgotten to check. I enter python --python and receive 2.7.1 and i wanna updated to the current version. Can i remove the Python folder from my home directory ? Or will it contain some sideeffekts? If I run python3 ( from the /urs/bin directory - the preinstalled python3 version - I receive also the error info, in case of python2not. Why? – michael-mammut May 26 '17 at 8:40
  • Who Knows? You haven't said how you installed, but there should be an uninstall option. Most normal installation methods wouldn't install in home. – Milliways May 26 '17 at 8:53
  • 1
    To use Python 3 the command is python3. How did you install Python 3.6? RPi.GPIO works as expected with Python 3.42 as installed. – joan May 26 '17 at 9:29
  • 1
    Change the link back to Python 3.4. cd /usr/bin; sudo rm python3; sudo ln -s python3.4 python3 – joan May 26 '17 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.