有关于 vim 的一个问题, 一直解决不了

2016-06-12 20:06:20 +08:00
 yech1990

只从升级了 ubuntu16.04 , vim 的 youcompletme 插件就彻底地奔溃了.

每次打开 vim 都有这样的报错.

 File "/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/autoload/../python/ycm/se
tup.py", line 47, in SetUpYCM
    from ycm.youcompleteme import YouCompleteMe
  File "/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/autoload/../python/ycm/yo
ucompleteme.py", line 41, in <module>
    from ycm.omni_completer import OmniCompleter
  File "/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/autoload/../python/ycm/om
ni_completer.py", line 30, in <module>
    from ycm.client.base_request import BaseRequest, HandleServerException
  File "/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/autoload/../python/ycm/cl
ient/base_request.py", line 26, in <module>
    import requests
  File "/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_pa
rty/requests/requests/__init__.py", line 58, in <module>
    from . import utils
  File "/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_pa
rty/requests/requests/utils.py", line 12, in <module>
    import cgi
  File "/usr/lib/python3.5/cgi.py", line 42, in <module>
    import html
  File "/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_pa
rty/python-future/src/html/__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to
 run from the python-future src folder or your installation of python-future is corrupte
d.
YouCompleteMe unavailable: This package should not be accessible on Python 3. Either you
 are trying to run from the python-future src folder or your installation of python-futu
re is corrupted.

vim 的基本配置

$ vim --version

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled May 15 2016 17:57:19)
Included patches: 1-1830
Compiled by root@yc-Lenovo
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +tag_binary
+arabic          +file_in_path    +mouse_sgr       +tag_old_static
+autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white
+balloon_eval    +float           +mouse_urxvt     -tcl
+browse          +folding         +mouse_xterm     +termguicolors
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+channel         +gettext         -mzscheme        +textobjects
+cindent         -hangul_input    +netbeans_intg   +timers
+clientserver    +iconv           +packages        +title
+clipboard       +insert_expand   +path_extra      +toolbar
+cmdline_compl   +job             +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python/dyn      +viminfo
+cscope          +lispindent      +python3/dyn     +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  +lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      +X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      +startuptime     +xsmp_interact
+eval            +mouse_dec       +statusline      +xterm_clipboard
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax          -xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2   -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E   -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lontconfig -lfreetype -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl    -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.22/CORE -lperl -ldl -lm -lpthread -lcrypt    -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm

$ py3 import pprint; pprint.pprint( sys.path )


['/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/je
di',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/Om
niSharpServer',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/ra
cerd',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/ar
gparse',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/go
def',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/wa
itress',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/Je
diHTTP',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/te
rn_runtime',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/te
rn',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/go
code',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/re
quests',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/fr
ozendict',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bo
ttle',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/retries',
 '/home/conf_file/vim-package/k-vim/bundle/Yo
 uCompleteMe/third_party/requests-futures',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/pythonfutures',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/python/ycm/../../third_party/yc
md',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/autoload/../python',
 '/home/conf_file/vim-package/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/py
thon-future/src',
 '/usr/lib/python3/dist-packages',
 '/usr/lib/python35.zip',
 '/usr/lib/python3.5',
 '/usr/lib/python3.5/plat-x86_64-linux-gnu',
 '/usr/lib/python3.5/lib-dynload',
 '/home/user/.local/lib/python3.5/site-packages',
 '/usr/local/lib/python3.5/dist-packages',
 '_vim_path_']

google 到的方法都试了, vim 也重新编译了, 依然无解.

奇怪的是 另一台电脑重新安装了 ubuntu16.04, 直接安装 vim, 却没任何问题.

3143 次点击
所在节点    问与答
2 条回复
guoer
2016-06-12 21:03:18 +08:00
YouCompleteMe unavailable: This package should not be accessible on Python 3. Either you
are trying to run from the python-future src folder or your installation of python-futu
re is corrupted.

装个 Python2.7 然后重新安装 YouCompleteMe
yech1990
2016-06-12 21:08:46 +08:00
@guoer 本来就有 python 2.7, 用 python 2.7 编译 youcompletme 依然出错

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/285194

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX