【发布时间】:2013-05-15 02:34:56
【问题描述】:
我尝试安装 UltiSnips 插件,但加载 Vim 时会产生大量错误:
Error detected while processing C:\Documents and Settings\username\vimfiles\bundle\UltiSnips-2.2\plugin\UltiSnips.vim:
line 226:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named os
line 229:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Documents and Settings\username\vimfiles\bundle\UltiSnips-2.2\pl
ugin\UltiSnips\__init__.py", line 4, in <module>
from functools import wraps
ImportError: No module named functools
line 230:
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'UltiSnips_Manager' is not defined
line 231:
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'UltiSnips_Manager' is not defined
line 232:
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'UltiSnips_Manager' is not defined
我做了什么:
我安装了病原体插件,然后将'UltiSnips-2.2.tar.gz'的内容提取到'vimfiles/bundle/'
我找到的安装说明:
http://www.vim.org/scripts/script.php?script_id=2715
说明仅提及“安装”的概念,以指示如何获取源代码。没有分步说明。粗略一瞥后,我相信“UltiSnips-2.2.tar.gz”的内容(直接在该页面上提供)与 git 存储库的内容相同。
编辑更多信息:
这是 Windows XP 上的 gvim。 :echo has("python") 返回1。
:version关于python的相关位是:
+python/dyn -python3
-DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL="python26.dll"
:version的全部内容:
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jan 4 2011 14:09:41)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-98
Compiled by digitectNO@SPAMdancingpaper.com
Huge version with GUI. Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info
+comments +conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff +digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search
+farsi +file_in_path +find_in_path +float +folding -footer +gettext/dyn -hangul_input +iconv/dyn +insert_expand +jumplist +keymap +langmap +libcall
+linebreak +lispindent +listcmds +localmap +lua/dyn +menu +mksession +modify_fname +mouse +mouseshape +multi_byte_ime/dyn +multi_lang
+mzscheme/dyn +netbeans_intg +ole -osfiletype +path_extra +perl/dyn +persistent_undo -postscript +printer +profile +python/dyn -python3 +quickfix
+reltime +rightleft +ruby/dyn +scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary +tag_old_static
-tag_any_white +tcl/dyn -tgetent -termresponse +textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -xfontset -xim -xterm_save -xpm_w32
system vimrc file: "$VIM\vimrc"
user vimrc file: "$HOME\_vimrc"
2nd user vimrc file: "$VIM\_vimrc"
user exrc file: "$HOME\_exrc"
2nd user exrc file: "$VIM\_exrc"
system gvimrc file: "$VIM\gvimrc"
user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$VIM\_gvimrc"
system menu file: "$VIMRUNTIME\menu.vim"
Compilation: gcc -O3 -fomit-frame-pointer -freg-struct-return -fno-strength-reduce -DWIN32 -DHAVE_PATHDEF -DFEAT_HUGE -DWINVER=0x0400 -D_WIN32_WINNT=0x0400 -DFEAT_PERL -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL="perl58.dll" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL="python26.dll" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL="msvcrt-ruby18.dll" -DDYNAMIC_RUBY_VER=18 -DFEAT_MZSCHEME -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL="libmzsch42.dll" -DDYNAMIC_MZGC_DLL="libmzgc42.dll" -DINCLUDE_MZSCHEME_BASE -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL="tcl85.dll" -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL="lua51.dll" -DDYNAMIC_GETTEXT -DDYNAMIC_ICONV -DFEAT_MBYTE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG -DFEAT_GUI_W32 -DFEAT_CLIPBOARD -DFEAT_OLE -march=i386 -Iproto -I/cygdrive/c/strawberry/perl/lib/CORE -I/cygdrive/c/RUBY/lib/ruby/1.8/i386-mswin32 -I/cygdrive/c/PROGRA~1/MzScheme/include -I/cygdrive/c/Tcl/include -I/cygdrive/c/PROGRA~1/Lua/5.1/include -s -mno-cygwin
Linking: gcc -s -o gvim.exe -luuid -lole32 /cygdrive/c/Tcl/lib/tclstub85.lib -lwsock32 -mwindows -lcomctl32 -lversion -loleaut32 -lstdc++
【问题讨论】:
-
你能做一个
vim --version | grep python吗?如果你不需要重新编译vim并支持python,你应该会看到+python。 (否则我认为你安装正确。如果你不这样做,你就不会得到错误) -
UtilSnips 是一个 python 编写的插件,所以你首先需要一个 python 环境。根据您的错误日志,您的 vim 似乎已在 python 支持下编译,但 python 无法正常运行。安装python(如果没有)并确保它可以正常运行。 (例如在命令行中启动它)
-
你能不能启动命令行的python并输入
import os,看看它是否会抛出错误。看起来你可能有一个残缺的 python 版本。 (您可能需要为其重新安装更多库) -
看起来解决方案是安装python 2.6,并将.dll的路径添加到“PATH”环境变量中。如果您将其重新发布为答案,我会将前两个 cmets 中的任何一个标记为已接受的答案。
标签: python vim installation code-snippets