如何在macOS上降级或移除Python 3.9?非conda环境下降级至3.7.7遇阻求助
Got it, let’s work through getting your macOS Python from 3.9 down to 3.7.7 without conda. Since you didn’t find Python 3.9 in /Library/Frameworks, it’s almost certainly installed via another method—let’s break this down step by step to track it down and replace it.
First, let’s pinpoint exactly where Python 3.9 is hiding. Open Terminal and run these two commands—they’ll tell us everything we need to know about the installation source:
which python3.9– This gives you the path to the 3.9 executable (e.g.,/usr/local/bin/python3.9)ls -l $(which python3.9)– This shows if it’s a symlink, and where it points to (critical for figuring out how it was installed)
Depending on what the above commands reveal, use the right uninstall method:
Case 1: Installed via Homebrew
If the symlink points to /usr/local/Cellar/python@3.9/..., it’s a Homebrew installation:
- First, confirm it’s listed in your Homebrew packages:
brew list | grep python - Uninstall it with:
brew uninstall python@3.9- If you hit dependency errors, you can add
--force(but be cautious—this might break tools that rely on Python 3.9; only do this if you’re sure you don’t need those tools anymore)
- If you hit dependency errors, you can add
Case 2: Installed via python.org package (user-specific)
Sometimes python.org installers put versions in your user Library instead of the system one. Check ~/Library/Frameworks/Python.framework/Versions/ for a 3.9 folder. If you find it:
- Delete the version folder:
sudo rm -rf ~/Library/Frameworks/Python.framework/Versions/3.9 - Remove any leftover symlinks in
/usr/local/bin:sudo rm /usr/local/bin/python3.9 /usr/local/bin/pip3.9
Case 3: Installed via pyenv (version manager)
If you used pyenv (a popular non-conda way to manage Python versions), run:
- Check your installed versions:
pyenv versions - Uninstall 3.9:
pyenv uninstall 3.9.x(replacexwith your minor version, like 3.9.13) - If you haven’t already installed 3.7.7, do so now:
pyenv install 3.7.7 - Set 3.7.7 as your global default:
pyenv global 3.7.7
If you don’t have 3.7.7 installed yet, pyenv is the safest method—no risk of messing with macOS’s system Python:
- Install pyenv if you don’t have it:
brew install pyenv - Add pyenv to your zsh profile (default shell on modern macOS):
- Run these three commands one by one:
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc echo 'eval "$(pyenv init -)"' >> ~/.zshrc
- Run these three commands one by one:
- Restart Terminal, then install 3.7.7:
pyenv install 3.7.7 - Set it as your global default:
pyenv global 3.7.7
Run these commands to confirm you’re now running Python 3.7.7:
python3 --versionpip3 --version
Important note: Never modify or delete the system Python that comes pre-installed with macOS (usually in /System/Library/Frameworks). That can break core OS functionality—we only ever touch the Python versions you installed yourself.
内容的提问来源于stack exchange,提问作者Stanislav Jirak

