树莓派3b的raspberrypi系统更改默认的python版本

输入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

结束。

posted @ 2021-07-13 22:16  逆水寒龙  阅读(1927)  评论(0编辑  收藏  举报