pyenv – it's safe, flexible, and doesn't require root.
If you want python3 to point to your new version (e.g., 3.12 ), change the system symlink. Instead: upgrade python linux
Regardless of how Python is upgraded, the most critical lesson for Linux users is the proper use of virtual environments. Once a newer version of Python is installed (via pyenv or package manager), it should rarely be used to run scripts directly via pip install . Instead, developers should create a virtual environment ( venv ) targeting that specific version. pyenv – it's safe, flexible, and doesn't require root
Upgrading Python on Linux can be approached in several ways, depending on your Linux distribution, whether you want to replace the system Python, and your need for multiple Python versions. This guide covers the safest and most common methods. Once a newer version of Python is installed
Visit python.org/downloads or use wget to get the latest version (replace 3.12.2 with the latest version):
To avoid breaking system-level tools, always create a virtual environment when starting a new project with your upgraded Python version.
# Install pyenv dependencies (same as Method 1) # Then install pyenv curl https://pyenv.run | bash
Size: 2 KB
Date: 2023-07-15 10:37:41