xcode 在MacOS上卸载python3

jdzmm42g  于 2023-11-21  发布在  Mac
关注(0)|答案(2)|浏览(299)

我有Python 3在macOS Catalina 10.15.3上使用brew:

  1. brew uninstall python3
  2. brew list | grep python
  3. python@2

字符串
但它仍然存在:

  1. which python3
  2. /usr/bin/python3
  3. python3 -V
  4. Python 3.7.3
  5. /usr/bin/python3 -V
  6. Python 3.7.3
  7. ls -ltah /usr/bin/ | grep python
  8. -rwxr-xr-x 1 root wheel 31K Jan 23 16:58 python3
  9. lrwxr-xr-x 1 root wheel 75B Dec 16 06:20 python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
  10. 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
  11. lrwxr-xr-x 1 root wheel 76B Dec 16 06:20 pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
  12. 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
  13. lrwxr-xr-x 1 root wheel 76B Dec 16 06:20 pythonw -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
  14. lrwxr-xr-x 1 root wheel 75B Dec 16 06:20 python2 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
  15. lrwxr-xr-x 1 root wheel 75B Dec 16 06:20 python -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7


这很有趣,但在错误时,它显示了Python的不同位置:

  1. python3 -bla
  2. Unknown option: -l
  3. 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] ...
  4. Try `python -h' for more information.


它与Xcode有关。
如何使用brew删除python 3并重新安装python?

更新:

  1. sudo rm -f /usr/bin/python3
  2. rm: /usr/bin/python3: Operation not permitted

yyyllmsg

yyyllmsg1#

Catalina 默认安装了python3**。你不能删除它,因为/usr/bin在系统的只读卷上。
如果你将新的python安装到$PATH/usr/bin之前的bin文件夹中,那么它应该优先。

  • (好吧,第一次运行它时,你必须安装Xcode命令行工具才能使它工作。但该文件本身是系统安装。)*
1rhkuytd

1rhkuytd2#

您只需像这样指定版本:

  1. brew uninstall [email protected]

字符串

相关问题