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

如何在Mac OS X 10.13系统中卸载Python 3.5并切换至Python 3.11.2

卸载Python 3.5并切换至Python 3.11.2的问题

现状说明

  • 执行python -V显示当前默认Python为3.5.2(Anaconda版本)
  • 执行python3 -V已成功指向Python 3.11.2
  • 尝试用pip uninstall python/pip uninstall python3卸载时,系统提示目标未安装;已尝试常规卸载教程,问题仍未解决

终端操作记录

OlympusII-2:Cellar johnyearsley$ python -V
Python 3.5.2 :: Anaconda 2.5.0 (x86_64)
OlympusII-2:Cellar johnyearsley$ pip uninstall python
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
WARNING: Skipping python as it is not installed.
OlympusII-2:Cellar johnyearsley$ pip uninstall python3
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
WARNING: Skipping python3 as it is not installed.
OlympusII-2:Cellar johnyearsley$ python3 -V
Python 3.11.2

解决步骤

1. 卸载Anaconda版本的Python 3.5

你的Python 3.5是Anaconda自带环境,无法通过pip卸载,需用Anaconda命令处理:

  • 激活Anaconda环境(若为base环境):conda activate base
  • 卸载指定版本Python:conda uninstall python=3.5.2
  • 若不再需要Anaconda,可直接删除整个环境:conda remove --name base --all(操作前请备份重要依赖包)

2. 将python命令默认指向3.11.2

当前python3已关联3.11.2,只需配置别名让python同步指向:

  • 编辑shell配置文件(zsh用户用~/.zshrc,bash用户用~/.bash_profile):open -e ~/.zshrc
  • 添加一行配置:alias python="python3"
  • 保存后生效配置:source ~/.zshrc
  • 验证:执行python -V,应显示Python 3.11.2

3. 清理残留文件(可选)

若仍有残留,手动删除相关目录:

  • 删除Anaconda安装目录(默认路径~/anaconda3):rm -rf ~/anaconda3
  • 检查python命令路径:which python,删除对应文件及关联链接

内容的提问来源于stack exchange,提问作者Whatcom Sasquatch

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.29 16:35:29