英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论