gpt4 book ai didi

python-3.x - 在 MacOs 上卸载 python3

转载 作者:行者123 更新时间:2023-12-04 12:13:30 24 4
gpt4 key购买 nike

我已经在 macOS Catalina 10.15.3 上使用 brew 卸载了 python3:

brew uninstall python3

brew list | grep python
python@2

但它仍然存在:
which python3
/usr/bin/python3

python3 -V
Python 3.7.3

/usr/bin/python3 -V
Python 3.7.3

ls -ltah /usr/bin/ | grep python

-rwxr-xr-x 1 root wheel 31K Jan 23 16:58 python3
lrwxr-xr-x 1 root wheel 75B Dec 16 06:20 python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x 1 root wheel 82B Dec 16 06:20 python-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
lrwxr-xr-x 1 root wheel 76B Dec 16 06:20 pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
lrwxr-xr-x 1 root wheel 82B Dec 16 06:20 python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
lrwxr-xr-x 1 root wheel 76B Dec 16 06:20 pythonw -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
lrwxr-xr-x 1 root wheel 75B Dec 16 06:20 python2 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x 1 root wheel 75B Dec 16 06:20 python -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

这很有趣,但出错时它显示 python 的不同位置:
python3 -bla

Unknown option: -l
usage: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

似乎它与Xcode有关。

如何删除这个版本的python3并使用brew重新安装python?

更新:
sudo rm -f /usr/bin/python3
rm: /usr/bin/python3: Operation not permitted

最佳答案

Catalina 默认安装了 python3 **。你不能删除它,因为 /usr/bin位于系统的只读卷上。
如果你将你的新 python 安装到 bin /usr/bin 之前的文件夹在您的 $PATH ,那么它应该优先。
**(好吧,第一次运行它时,您必须安装 Xcode 命令行工具才能使其工作。但该文件本身是系统安装。)

关于python-3.x - 在 MacOs 上卸载 python3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60280377/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com