用homebrew 升级安装python3.7 之后系统的python版本还是旧的怎么办

mac 中安装了多个版本的python$ brew install python3

复制代码
Updating Homebrew...
Warning: python 3.7.1 is already installed, it's just not linked
You can use `brew link python` to link this version.
#brew 提示已经安装了 3.7.1
但是系统变量里检测不到 并提示用 `brew link python` 来链接
$ brew link python
Linking /usr/local/Cellar/python/3.7.1... 
Error: Could not symlink bin/2to3
Target /usr/local/bin/2to3
already exists. You may want to remove it:
  rm '/usr/local/bin/2to3'

To force the link and overwrite all conflicting files:
  brew link --overwrite python

To list all files that would be deleted:
  brew link --overwrite --dry-run python

#链接错误 提示有  /usr/local/bin/2to3 需要删除然后重写
$ brew link --overwrite python
Linking /usr/local/Cellar/python/3.7.1... 24 symlinks created
#成功之后 查看版本。。
$ python3 --version
Python 3.6.5

$python --version
Python 3.6.4 :: Anaconda, Inc.
两种的命令显示的版本不一样。由于之前安装了anaconda,anaconda 之前用的版本python指定了3.
6.4,和anaconda绑定的
现在用brew安装了之后并没有链接到系统变量。 之后又用安装包的格式下载了 python
3.7.1 然后 $ python3 --version Python 3.7.1 可见通过官方安装包安装的会自动注册环境变量 经过验证凡是通过安装包安装的都会在下面的目录下: /Library/Frameworks/Python.framework/Versions/3.4 /Library/Frameworks/Python.framework/Versions/3.6 /Library/Frameworks/Python.framework/Versions/3.7 通过brew 安装的都会在 /usr/local/Cellar/python/3.7.1 并且在子目录中 /usr/local/Cellar/python/3.7.1/Python\ Launcher\ 3.app idle 3 和 Python Launcher
复制代码

 综上,尽量用官方网站提供的安装包,不用做额外的操作,制动链接系统变量

posted @   wjwdive  阅读(9365)  评论(1编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示