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

时间:2020-11-07 22:56:04

标签: python-3.x macos python-2.7 pip homebrew

请包括终端步骤以消除此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.

1 个答案:

答案 0 :(得分:1)

单独保留python2 macos本机安装,可能某些系统实用程序需要它。
如果您需要自制软件来安装python3,请执行以下操作:

macOS Requirements

  • 64位Intel CPU 1
  • macOS High Sierra(10.13)(或更高版本)
  • 用于Xcode的命令行工具(CLT):xcode-select --install, developer.apple.com/downloads or Xcode
  • 用于安装的Bourne兼容外壳(例如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应用程序的实用程序-可能不是您想要的!