Ready to embrace the power of Python 3.11 as your default Python3 version? 🐍 Let’s make it happen! Just follow these simple steps:
1️⃣ First, let’s check your current default Python version. Open your terminal and run the following command:
In my AWS instance, the command
python3 pointed to my installed Python version 3.9 instead but I wanted it to point to 3.11.
2️⃣ Next, we’ll use
update-alternatives to create symbolic links to Python 3.10 and Python 3.11. You can replace it with your specific Python versions as you see fit. Each is identified using an integer value
Enter these commands one by one:
The first command sets the Python version 3.9 to identifier
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
The second command sets the Python version 3.11 to identifier
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2
3️⃣ Now, it’s time to choose Python 3.11 as your go-to Python3! 🔥 Type the command below:
sudo update-alternatives --config python3
Now you can type in the identifier of the Python version you want as default for the command
python3. In my case, it would be
2 because I want
python3.11. See here:
✨ Ta-da! You’ve successfully set up Python 3.11 as your default version! 🎉
Feel free to switch between Python versions at any time using the commands provided above. Remember, with great power comes great responsibility: after switching to 3.11, make sure to check if all your essential apps are working smoothly. 🕵️♀️
💡 Recommended: How to Check Your Python Version?
While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.
To help students reach higher levels of Python success, he founded the programming education website Finxter.com that has taught exponential skills to millions of coders worldwide. He’s the author of the best-selling programming books Python One-Liners (NoStarch 2020), The Art of Clean Code (NoStarch 2022), and The Book of Dash (NoStarch 2022). Chris also coauthored the Coffee Break Python series of self-published books. He’s a computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.
His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.