Upgrade Your Python to Version 3.9: A Comprehensive Guide
Written on
Introduction to Python 3.9
On October 5, 2020, Python 3.9 was officially released, introducing a range of exciting features and enhancements. Notable additions include Union Operators within dictionaries, Type Hinting Generics in standard collections, and flexible function and variable annotations. This guide will walk you through the straightforward process of updating your Python installation to version 3.9 across various operating systems.
Section 1: Upgrading Python on Windows
To upgrade Python on Windows, simply download the installer for Python 3.9 from the official Python download page. If you're uncertain about which version to choose, it's best to opt for the Windows x86-64 executable installer. You can find it easily by following this link.
Make sure to select the “Add Python to PATH” option during installation to set Python 3.9 as the default version on your system. To verify the installation, you can use the command:
$ python --version
Python 3.9.0
Section 2: Upgrading Python on macOS
For macOS users, the upgrade process is similar to that of Windows. Download Python 3.9 from the Python download page. To check your current Python version, use the following commands:
$ python --version
Python 2.x.x
$ python3 --version
Python 3.9.0
If you'd prefer to run Python 3.9 using the python command instead of python3, you can set an alias in your .bash_profile located in your home directory. Open your terminal and execute:
$ cd $HOME
$ nano .bash_profile
Add this line at the end:
alias python="python3"
Now, you can run Python 3.9 simply by typing python:
$ python --version
Python 3.9.0
Section 3: Upgrading Python on Linux
For Linux users, you can install Python 3.9 by running the following commands:
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt update
$ sudo apt install python3.9
To check the version of your newly installed Python, use:
$ sudo python --version
2.x.x
$ sudo python3 --version
3.8.x
$ sudo python3.9 --version
3.9.0
Conclusion
That's all there is to it! Enjoy coding with Python 3.9! Stay safe and healthy, and thank you for reading.
This video provides a quick guide on how to update Python on Windows, ensuring you have the latest features and optimizations.
This video tutorial explains how to upgrade Python on Windows, making the process seamless and efficient.