如何在Ubuntu上更改默认的Java和Python版本。

huangapple go评论72阅读模式
英文:

How to change the default Java and Python version on Ubuntu

问题

You can change your default Java and Python versions on Ubuntu 18 using the following commands:

To change the default Java version:

sudo update-alternatives --config java

To change the default Python version:

sudo update-alternatives --config python

Please note that you'll need superuser privileges (sudo) to make these changes.

英文:

I am using ubuntu 18 and have
multiple versions of java and python installed, How do I change my default version.

答案1

得分: 2

请使用以下命令列出可用选项:

sudo update-alternatives --config java

它会要求您从可用版本中进行选择。

只需输入选择编号,您的默认Java版本就会更改。

但同样的方法可能不适用于Python:

sudo update-alternatives --config python

可能会出现错误没有Python的备选项

要将默认Python更改为Python 3,请执行以下操作:

update-alternatives --install /usr/bin/python python /usr/bin/python3.6 10

这里的10代表权重,您可以选择任意您喜欢的数字。

英文:

Use the following command to list the available options

sudo update-alternatives --config java

it will ask to choose from the available versions

just enter the selection number and bingo your default java version is changed.

but the same might not work for python

sudo update-alternatives --config python

might give an error no alternatives for python

To change default python to python3

update-alternatives --install /usr/bin/python python /usr/bin/python3.6 10

10 here represents the weight, you can give any number of your choice

huangapple
  • 本文由 发表于 2020年8月11日 00:30:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/63344203.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定