如何从 OSX 中完全删除 python2 以便 Brew 安装 NEOVIM 并拥有最新版本的 Python

How to completely remove python2 from OSX so that Brew Install NEOVIM and have the latest version of Python

请包含消除此 pip 错误的终端步骤和 python2

|===> pip install homebrew
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: homebrew in ./Library/Python/2.7/lib/python/site-packages (0.2.1)


|===> pip install homebrew
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: homebrew in ./Library/Python/2.7/lib/python/site-packages (0.2.1)
____________________

|===> brew install neovim
-bash: brew: command not found
____________________

|===> pip install brew
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting brew
  Downloading brew-0.1.4.zip (48 kB)
     |████████████████████████████████| 48 kB 386 kB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/0q/n_flnz9j637ds046sshnyvzc0000gp/T/pip-install-K9LQMe/brew/setup.py'"'"'; __file__='"'"'/private/var/folders/0q/n_flnz9j637ds046sshnyvzc0000gp/T/pip-install-K9LQMe/brew/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/0q/n_flnz9j637ds046sshnyvzc0000gp/T/pip-pip-egg-info-jnO1ML
         cwd: /private/var/folders/0q/n_flnz9j637ds046sshnyvzc0000gp/T/pip-install-K9LQMe/brew/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/0q/n_flnz9j637ds046sshnyvzc0000gp/T/pip-install-K9LQMe/brew/setup.py", line 22, in <module>
        with open('requirements.txt') as fid:
    IOError: [Errno 2] No such file or directory: 'requirements.txt'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

|===> pip uninstall python2
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
WARNING: Skipping python2 as it is not installed.

不要管本机 python2 macos 安装,很可能您的某些系统实用程序需要它。
如果需要 homebrew 来安装 python3,请执行以下操作:

macOS Requirements

  • 64 位英特尔 CPU 1
  • macOS High Sierra (10.13)(或更高版本)
  • Xcode 的命令行工具 (CLT):xcode-select --install, developer.apple.com/downloads or Xcode
  • A Bourne-compatible shell 用于安装(例如 bash 或 zsh)

然后,在命令行上:

如图here:

 $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

或推荐 there:

mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

安装好homebrew后,可以brew install python3,说明here

注:

pip install homebrew 将从 pipy 安装一个 python 软件包,您可以从 python 导入该软件包。 IDK 这个包的作用,但它很可能是一个使用 python 来帮助生成 brew installable 应用程序的实用程序 - 可能不是你想要的!