輸入python看默認版本,一般是2.7。
1、刪除軟鏈接命令
pi@raspberrypi:~ $ sudo rm /usr/bin/python
2、查看本機安裝的python版本及路徑
pi@raspberrypi:~ $ whereis python python: /usr/bin/python2.7 /usr/bin/python3.7 /usr/bin/python3.7m /usr/bin/python /usr/lib/python2.7 /usr/lib/python3.7 /etc/python2.7 /etc/python3.7
/etc/python /usr/local/lib/python2.7 /usr/local/lib/python3.7 /usr/share/python /usr/share/man/man1/python.1.gzc
3、重新創建軟鏈接命令
pi@raspberrypi:~ $ sudo ln -s /usr/bin/python3.7 /usr/bin/python
4、查看python版本命令
pi@raspberrypi:~ $ python Python 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> exit() pi@raspberrypi:~ $ python --version Python 3.7.3
結束。