打開 vim
以後,出現以下錯誤:python
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 warning
。imp
從 python3.4
以後 已經再也不使用。
顯然,這個問題是由 ycm
這個插件加載時引發的,能夠經過修改 ycm
源碼解決。git
有如下幾種:
1.從新安裝 vim
,可是採用較低版本的 python
2.修改 ycm
報錯部分的代碼
具體修改以下:vim PLUG_PATH/YouCompleteMe/autoload/youcompleteme.vim
修改以下:github
diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 597eb020..32461fa9 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -180,7 +180,7 @@ endfunction function! s:SetUpPython() abort - exec s:python_until_eof + silent! exec s:python_until_eof from __future__ import unicode_literals from __future__ import print_function from __future__ import division
參考:Error message printed first time python3 (version 3.7.0) dynamic library is imported shell
更新:這個問題出如今使用 Python 3.7 的狀況,
能夠暫時在 .vimrc
中作以下配置,並等待更新 Python 3.7 來解決這個問題:vim
" temporary fix " https://github.com/vim/vim/issues/3117 if has('python3') silent! python3 1 endif