You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在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.

Step 1: Locate your Python 3.9 installation

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)
Step 2: Uninstall Python 3.9 based on its source

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)

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 (replace x with 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
Step 3: Install Python 3.7.7 (if you haven’t already)

If you don’t have 3.7.7 installed yet, pyenv is the safest method—no risk of messing with macOS’s system Python:

  1. Install pyenv if you don’t have it: brew install pyenv
  2. 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
      
  3. Restart Terminal, then install 3.7.7: pyenv install 3.7.7
  4. Set it as your global default: pyenv global 3.7.7
Step 4: Verify the change

Run these commands to confirm you’re now running Python 3.7.7:

  • python3 --version
  • pip3 --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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 12:38:12