Mac 卸载 彻底删除 自己下载的 python 3

看了网上python 相关的教程 感觉还是要anaconda ,准备卸载自己之前在官网安装的python3.6.1 。

参考:https://www.jianshu.com/p/e6f6cb821e3f

1.去应用程序中 把python3.6 移到垃圾箱

   或者 打开终端  sudo rm -rf "/Applications/Python 3.6"

2.# python3版本查看

$ python3 --version
Python 3.6.1

  # 删除Python 3.6 框架:

$ ls /Library/Frameworks/Python.framework/Versions/
2.7  3.6  current 

$ sudo rm -rf /Library/Frameworks/Python.framework/Versions/3.6

3.删除指向python的链接

  由于清除链接 很多文章里面都是:brew prune

  清除之前先安装Homebrew(还需先安装Command Line tools for xcode)  参考 https://www.jianshu.com/p/bca8fc1ff3f0  

  • 安装XCode或者Command Line Tools for Xcode。Xcode可以从AppStore里下载安装,Command Line Tools for Xcode需要在终端中输入以下代码运行安装:

    xcode-select --install
    
  • 安装Homebrew。将以下命令粘贴至终端

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

 两个都安装好后,

$ cd /usr/local/bin/
ls -l /usr/local/bin | grep '/Library/Frameworks/Python.framework/Versions/3.6' # 查看链接
brew prune # 清除链接和目录

结果可能会提示 Calling 'brew prune' is deprecated! Use 'brew cleanup' instead.

Pruned * symbolic links from /usr/local 。 

此时再在终端输入 python3 

提示 -bash: python3: command not found   

输入 $ ls /Library/Frameworks/Python.framework/Versions/

提示 2.7 Current

(我的还提示了3.4.1 , 然后把3.6 改成3.4 再重复操作一遍就好了)。



 

猜你喜欢

转载自blog.csdn.net/a476918486/article/details/86234510