Debian中切换python版本

Debian中切换python版本

当你安装 Debian Linux 时,安装过程有可能同时为你提供多个可用的 Python 版本,因此系统中会存在多个 Python 的可执行二进制文件,你可以按照以下方法使用 ls 命令来查看你的系统中都有那些 Python 的二进制文件可供使用:

# update-alternatives –list python
/usr/bin/python2.7
/usr/bin/python3.4

我们就可以使用下方的命令随时在列出的 Python 替代版本中任意切换:

# update-alternatives –config python

一旦我们的系统中不再存在某个 Python 的替代版本时,我们可以将其从 update-alternatives 列表中删除掉。例如,我们可以将列表中的 python2.7 版本移除掉。

# update-alternatives –remove python /usr/bin/python2.7

也可以将列表中的 python2.7 版本添加进去。其中1代表优先级,大的优先。

# update-alternatives –install /usr/bin/python python /usr/bin/python2.7 1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值