Software & AppsOperating SystemLinux

How To Update Python 3.8 to 3.9 and Set IDLE Shell 3.9 as Default in Ubuntu 20.04

Ubuntu 14

In this article, we will guide you through the process of updating Python 3.8 to 3.9 and setting IDLE Shell 3.9 as the default in Ubuntu 20.04. This is a detailed, step-by-step guide that aims to be as helpful as possible.

Quick Answer

To update Python 3.8 to 3.9 and set IDLE Shell 3.9 as the default in Ubuntu 20.04, you can use pyenv to manage multiple Python versions and install Python 3.9.7. Then, install the IDLE package for Python 3.9 using apt and launch IDLE Shell 3.9 with the command idle-python3.9.

Introduction

Python is a versatile, high-level programming language that is widely used for various types of programming and software development. IDLE (Integrated Development and Learning Environment) is an integrated development environment for Python, which is included with the standard Python distribution.

Before we begin, it’s important to note that you should NOT interfere with the system-installed Python as it can cause issues with package management and system functionality. Instead, we will use pyenv, a simple yet powerful Python version management tool.

Installing pyenv

pyenv allows you to manage multiple Python versions in parallel, which means you can use Python 3.9 without affecting the system-installed Python. You can install pyenv by following the instructions on the pyenv GitHub page.

Updating Python 3.8 to 3.9

After installing pyenv, you can install Python 3.9.7 by opening a terminal and running the following command:

pyenv install 3.9.7

This command will download, build, and install Python 3.9.7 into your user space. This will not affect the system-installed Python.

Next, set Python 3.9.7 as the local version for your shell by running:

pyenv local 3.9.7

This command sets the Python version for the current directory and all sub-directories. Be sure to check that pyenv global still shows ‘system’ as the result to avoid breaking apt and other system functions.

Installing and Setting IDLE Shell 3.9 as Default

Now that Python 3.9 is installed, you can install the IDLE package for Python 3.9 by running the following command in the terminal:

sudo apt install idle-python3.9

The sudo command allows you to run programs with the security privileges of the superuser. apt is a command-line interface that allows you to interact with Ubuntu’s Advanced Packaging Tool (APT). The install command followed by idle-python3.9 installs the IDLE package for Python 3.9.

You can start IDLE with the command:

idle-python3.9

This command launches the IDLE Shell for Python 3.9. You can also create a shortcut on the GUI to directly launch IDLE.

Conclusion

By following these steps, you can safely update Python 3.8 to 3.9 and set IDLE Shell 3.9 as the default in Ubuntu 20.04. Remember, the system-installed Python version is important for package management and system functionality. By using pyenv, you can have multiple Python versions without affecting the system. Happy coding!

Can I update Python 3.8 to 3.9 without affecting the system-installed Python?

Yes, by using pyenv, you can install and manage Python versions in your user space without affecting the system-installed Python.

How do I install `pyenv`?

You can install pyenv by following the instructions on the pyenv GitHub page.

How do I install Python 3.9.7 using `pyenv`?

After installing pyenv, open a terminal and run the command pyenv install 3.9.7. This will download, build, and install Python 3.9.7 into your user space.

How do I set Python 3.9.7 as the local version for my shell?

Run the command pyenv local 3.9.7 in the terminal. This will set Python 3.9.7 as the version for the current directory and all sub-directories.

Can I still use the system-installed Python after updating to Python 3.9?

Yes, you can still use the system-installed Python alongside the Python version managed by pyenv. Ensure that pyenv global still shows ‘system’ as the result to avoid breaking apt and other system functions.

How do I install IDLE Shell 3.9 for Python 3.9?

Run the command sudo apt install idle-python3.9 in the terminal. This will install the IDLE package for Python 3.9.

How do I start IDLE Shell 3.9?

Use the command idle-python3.9 in the terminal to launch the IDLE Shell for Python 3.9. You can also create a shortcut on the GUI to directly launch IDLE.

Leave a Comment

Your email address will not be published. Required fields are marked *