Raspberry Pi: Setting default Python Version - msandholz/RaspberryPi-Tutorials GitHub Wiki
pi@RasPi-Desktop:~/ $ python2 --version
Python 2.7.16
pi@RasPi-Desktop:~/ $ python3 --version
Python 3.7.3
- Set the default version of python
pi@RasPi-Desktop:~/ $ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
pi@RasPi-Desktop:~/ $ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
update-alternatives: /usr/bin/python3.7 wird verwendet, um /usr/bin/python (python) im automatischen Modus bereitzustellen
pi@RasPi-Desktop:~/Desktop/Python/MQTT $ sudo update-alternatives --config python
Es gibt 2 Auswahlmöglichkeiten für die Alternative python (welche /usr/bin/python bereitstellen).
Auswahl Pfad Priorität Status
------------------------------------------------------------
* 0 /usr/bin/python3.7 2 automatischer Modus
1 /usr/bin/python2.7 1 manueller Modus
2 /usr/bin/python3.7 2 manueller Modus
Drücken Sie die Eingabetaste, um die aktuelle Wahl[*] beizubehalten,
oder geben Sie die Auswahlnummer ein: 0
- Check default python version:
pi@RasPi-Desktop:~/ $ python --version
Python 3.7.3