侧边栏壁纸
博主头像
★街角晚灯★ 博主等级

博观而约取 厚积而薄发

  • 累计撰写 468 篇文章
  • 累计创建 185 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

macOS 修改Python软链接 | Python版本升级

WinJay
2024-02-06 / 0 评论 / 0 点赞 / 21 阅读 / 0 字 / 正在检测是否收录...

image-20240206131700593

which python                                                                                                                 
python: aliased to /usr/local/bin/python3
which python3                                                                                                                
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3
ls -al /usr/local/bin/python3                                                                                                
lrwxr-xr-x  1 root  wheel  70 11 19 22:42 /usr/local/bin/python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.10/bin/python3
ls -al /Library/Frameworks/Python.framework/Versions/3.10/bin/python3                                             
lrwxrwxr-x  1 root  admin  10 11 19 22:42 /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -> python3.10
ls -al /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10                                      
-rwxrwxr-x  1 root  admin  152624  4  5  2023 /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10

image-20240206115447200

image-20240206115631213

  • 即由此条链接修改即可,将

    /usr/local/bin/python3 -> ../Cellar/python@3.10/3.10.9/bin/python3

    链接改到最新版/usr/local/Cellar/python@3.11/3.11.1/bin/python3.11

  • 链接前先删除此目录下原来的链接文件。

ln -s /usr/local/Cellar/python@3.11/3.11.1/bin/python3.11 /usr/local/bin/python3

ln -s /usr/local/Cellar/python@3.11/3.11.1/bin/python3.11-config /usr/local/bin/python3-config

哎呀,或者直接删除原来的链接文件,直接将此目录下最新版的文件重命名成python3

ls -al /usr/local/Cellar/python@3.10/3.10.9/bin/python3
lrwxr-xr-x  1 WinJay  admin  56 12  7 02:44 /usr/local/Cellar/python@3.10/3.10.9/bin/python3 -> ../Frameworks/Python.framework/Versions/3.10/bin/python3

Real Addr

/usr/local/Cellar/python@3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/bin/python3

 ls -al /usr/local/bin/python3.12                                                                                           
lrwxr-xr-x  1 WinJay  admin  45  1 19 21:20 /usr/local/bin/python3.12 -> ../Cellar/python@3.12/3.12.1_1/bin/python3.12
 ls -al /usr/local/bin/python3                                                                                                
lrwxr-xr-x  1 root  wheel  70 11 19 22:42 /usr/local/bin/python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.10/bin/python3
ls -al /usr/local/bin/python3.10                                                                                             
lrwxr-xr-x  1 root  wheel  73 11 19 22:42 /usr/local/bin/python3.10 -> ../../../Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10

image-20240206131255123

0
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin

评论区