Python 通过自制程序安装最新版本vim时出现协议错误

Python 通过自制程序安装最新版本vim时出现协议错误,python,homebrew,Python,Homebrew,我最近通过自制在mac上升级了vim(brew安装vim)。这也会更新Python,但无法更新,并且会出现NameError:name“PROTOCOL\u TLS”未定义的错误 以下是完整的输出: $ brew install vim ==> Installing dependencies for vim: python ==> Installing vim dependency: python ==> Downloading https://homebrew.bintray

我最近通过自制在mac上升级了
vim
brew安装vim
)。这也会更新Python,但无法更新,并且会出现
NameError:name“PROTOCOL\u TLS”未定义的错误

以下是完整的输出:

$ brew install vim
==> Installing dependencies for vim: python
==> Installing vim dependency: python
==> Downloading https://homebrew.bintray.com/bottles/python-2.7.13.sierra.bottle.tar.gz
Already downloaded: /Users/me/Library/Caches/Homebrew/python-2.7.13.sierra.bottle.tar.gz
==> Pouring python-2.7.13.sierra.bottle.tar.gz
==> Using the sandbox
==> /usr/local/Cellar/python/2.7.13/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt --install-scripts=/u
Last 15 lines from /Users/me/Library/Logs/Homebrew/python/post_install.01.python:
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/Cellar/python/2.7.13/libexec/setuptools/setuptools/command/install_scripts.py", line 17, in run
    import setuptools.command.easy_install as ei
  File "/usr/local/Cellar/python/2.7.13/libexec/setuptools/setuptools/command/easy_install.py", line 51, in <module>
    from setuptools.package_index import (
  File "/usr/local/Cellar/python/2.7.13/libexec/setuptools/setuptools/package_index.py", line 15, in <module>
    from urllib2 import splituser
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 94, in <module>
    import httplib
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1230, in <module>
    import ssl
  File     "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 133, in <module>
    PROTOCOL_SSLv23 = PROTOCOL_TLS
NameError: name 'PROTOCOL_TLS' is not defined
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall python`
==> Caveats
Pip and setuptools have been installed. To update them
  pip install --upgrade pip setuptools

You can install Python packages with
  pip install <package>

They will install into the site-package directory
  /usr/local/lib/python2.7/site-packages

See: http://docs.brew.sh/Homebrew-and-Python.html
==> Summary
I was able to solve this by telling homebrew to use a custom python version. Here are the steps I took to get this working correctly.

brew uninstall vim
brew uninstall python # remove 2.7.13 version
brew switch python 2.7.12
brew install vim --with-custom-python
$brew安装vim
==>安装vim:python的依赖项
==>安装vim依赖项:python
==>下载https://homebrew.bintray.com/bottles/python-2.7.13.sierra.bottle.tar.gz
已下载:/Users/me/Library/Caches/Homebrew/python-2.7.13.sierra.battle.tar.gz
==>python-2.7.13.sierra.bottle.tar.gz
==>使用沙箱
==>/usr/local/ceral/python/2.7.13/bin/python-s setup.py--无用户cfg安装--强制--详细--外部管理的单一版本--记录=installed.txt--安装脚本=/u
/Users/me/Library/Logs/Homebrew/python/post_install.01.python的最后15行:
文件“/usr/local/ceral/python/2.7.13/Frameworks/python.framework/Versions/2.7/lib/python2.7/distutils/dist.py”,第972行,在run_命令中
cmd_obj.run()
文件“/usr/local/ceral/python/2.7.13/libexec/setuptools/setuptools/command/install_scripts.py”,第17行,处于运行状态
导入setuptools.command.easy\u作为ei安装
文件“/usr/local/ceral/python/2.7.13/libexec/setuptools/setuptools/command/easy_install.py”,第51行,在
从setuptools.package\u索引导入(
文件“/usr/local/ceral/python/2.7.13/libexec/setuptools/setuptools/package_index.py”,第15行,在
从urllib2导入splituser
文件“/usr/local/ceral/python/2.7.13/Frameworks/python.framework/Versions/2.7/lib/python2.7/urllib2.py”,第94行,在
导入httplib
文件“/usr/local/ceral/python/2.7.13/Frameworks/python.framework/Versions/2.7/lib/python2.7/httplib.py”,第1230行,在
导入ssl
文件“/usr/local/ceral/python/2.7.13/Frameworks/python.framework/Versions/2.7/lib/python2.7/ssl.py”,第133行,在
协议\u SSLv23=协议\u TLS
NameError:未定义名称“协议\u TLS”
警告:安装后步骤未成功完成
您可以使用“brew postinstall python”重试`
==>注意事项
已安装Pip和setuptools。若要更新它们
pip安装--升级pip安装工具
您可以使用安装Python包
pip安装
它们将安装到站点包目录中
/usr/local/lib/python2.7/site-packages
见:http://docs.brew.sh/Homebrew-and-Python.html
==>摘要

我告诉homebrew使用自定义的python版本来解决这个问题


我告诉homebrew使用自定义的python版本来解决这个问题


这是一个针对自制问题跟踪者的问题。这是一个针对自制问题跟踪者的问题。