解决 vim 报错:the imp module is deprecated in favour of importlib

问题描述:
打开 vim 之后,出现如下错误:

Error detected while processing function youcompleteme#Enable[3]..<SNR>71_SetUpPython:
line   42:
/must>not&exist/foo:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

原因:
这个问题出现在使用 Python 3.7 的情况,
可以暂时在 .vimrc 中做如下配置,并等待更新 Python 3.7 来解决这个问题:

解决办法:
在.vimrc中加入如下

" temporary fix
" https://github.com/vim/vim/issues/3117
if has('python3')
  silent! python3 1
endif

其他解决方法:
https://github.com/vim/vim/issues/3117

原文地址:https://www.cnblogs.com/theodoric008/p/9359039.html