【问题标题】:How to uninstall definitely python 2.7 on MacOS [duplicate]如何在 MacOS 上明确卸载 python 2.7 [重复]
【发布时间】:2018-11-02 13:45:10
【问题描述】:

我已经安装了 python 3.6.5(使用 brew),当我在 shell 中执行 python 命令时,总是出现 python 2.7。

我已经在other post 中执行了这些命令,但没有任何效果:

Remove the third-party Python 2.7 framework

sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7

Remove the Python 2.7 applications directory

sudo rm -rf "/Applications/Python 2.7"

Remove the symbolic links in /usr/local/bin that point to this Python version see ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7' and then run the following command to remove all the links:

cd /usr/local/bin/
ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7' | awk '{print $9}' | tr -d @ | xargs rm

【问题讨论】:

  • 试试python3 ?

标签: python macos


【解决方案1】:

macOS 中总是有一个系统 Python 2.7 (/usr/bin/python),你无法真正删除它。

如果您想运行 Python 3,请使用 python3

有关命名法的详细信息,请参阅PEP 0394

【讨论】:

  • > 别名 python='python3'
猜你喜欢
  • 2017-01-04
  • 2013-03-01
  • 2013-08-31
  • 2011-04-18
  • 2015-09-19
  • 2018-06-02
  • 2019-08-07
  • 1970-01-01
相关资源
最近更新 更多