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

时间:2021-07-14 18:43:59   收藏:0   阅读:0

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

结束。

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!