我已经安装了 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
最佳答案
macOS 中始终存在一个系统 Python 2.7 (/usr/bin/python
),您无法真正删除它。
如果您想运行 Python 3,请使用 python3
。
参见PEP 0394有关命名法的详细信息。
关于python - 如何在 MacOS 上绝对卸载 python 2.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50490569/