First downgrade Python 3.12.7 to 3.10.0, and then set 3.10.0 version to the default version
Step 1:
To downgrade Python from 3.12.7 to 3.10.0, you can use the following methods:
Method 1: Download and install from the official Python website (recommended)
Go toPython 3.10.0 download page。
Download the installation package suitable for macOS (such as.pkg
File), and then follow the installation wizard to install.
After the installation is complete, use the following command to verify the Python version:
/usr/local/bin/python3.10 --version
Method 2: Use pyenv
ifpyenv
Already installed, it can be easily installed and switched to a specific Python version.
Install Python 3.10.0:
pyenv install 3.10.0
Set Python 3.10.0 to the global default version:
pyenv global 3.10.0
Verify the current Python version:
python --version
If there are other versions of Python on the system, you can use the full path/usr/local/bin/python3.10
To specify Python 3.10.
Step 2:
Now that you have Python 3.10.0 installed, set it as the default version now. Here are a few methods:
Method 1: Update the Shell configuration file
Set Python 3.10 as the default Python version. Open your shell configuration file (e.g.~/.bash_profile
or~/.zshrc
):
nano ~/.bash_profile # or nano ~/.zshrc
After entering the editor, add the following line directly at the end, and set Python 3.10 as the default version:
alias python='/usr/local/bin/python3.10' alias python3='/usr/local/bin/python3.10'
Save and close the file, and then reload the configuration:
source ~/.bash_profile # or source ~/.zshrc
Attachment: Here in the nano editor:
Save the file: Press Ctrl + O (the letter O stands for "Output");
Exit nano: Press Ctrl + X
Verify that the settings are successful:
python --version
Method 2: Add Python 3.10 to the system path
Will/usr/local/bin
Python 3.10 in is set to global priority and you can add this directory directly before the path.
edit~/.bash_profile
or~/.zshrc
:
nano ~/.bash_profile # or nano ~/.zshrc
Add the following line at the top of the file:
export PATH="/usr/local/bin:$PATH"
Save and close the file, and then reload the configuration:
source ~/.bash_profile # or source ~/.zshrc
This way, you should be able to use Python 3.10 by default every time you open the terminal.
This is the article about the methods and steps for downgrading python 3.12.7 to 3.10.0. This is all about this article. For more related content on downgrading python 3.12.7 to 3.10.0, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!