我在让Python 3在vim中工作时遇到了麻烦。我已经从vim github下载了最新的8.0源代码,并且我一直使用包含Python 3.6的Anaconda发行版配置它:
./configure \
--with-features=huge \
--enable-multibyte \
--enable-cscope \
--enable-multibyte \
--enable-python3interp=yes \
--with-features=huge \
--with-python3-config-dir=$ANACONDA_PATH/lib/python3.6/config-3.6m-x86_64-linux-gnu \
--enable-fail-if-missing \
--prefix=$LOCAL_BIN
按常规方式(make -j
),安装,然后运行,测试Python 3
包含:
:python3 import sys
然后我得到SIGABRT
杀死vim。我添加了Vundle klen/python-mode
,它在启动时杀死了vim:
Fatal Python error: PyThreadState_Get: no current thread
我见过很多人在OS X上使用YCM时遇到此错误,而MacPorts /系统捆绑版本的Python变得混乱。这似乎不是这里的情况,我正在运行运行3.16内核的Debian机器,检查vim --version
显示python3已正确编译,并且它指向python3.6库的正确区域( /usr/local/lib
)中没有冲突:
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Aug 19 2017 11:46:55)
Included patches: 1-966
Compiled by Matt
Huge version without GUI. Features included (+) or not (-):
+acl +file_in_path +mouse_sgr +tag_old_static
+arabic +find_in_path -mouse_sysmouse -tag_any_white
+autocmd +float +mouse_urxvt -tcl
-balloon_eval +folding +mouse_xterm +termguicolors
-browse -footer +multi_byte -terminal
++builtin_terms +fork() +multi_lang +terminfo
+byte_offset +gettext -mzscheme +termresponse
+channel -hangul_input +netbeans_intg +textobjects
+cindent +iconv +num64 +timers
+clientserver +insert_expand +packages +title
+clipboard +job +path_extra -toolbar
+cmdline_compl +jumplist -perl +user_commands
+cmdline_hist +keymap +persistent_undo +vertsplit
+cmdline_info +lambda +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak -python +viminfo
+cscope +lispindent +python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con -lua +rightleft +windows
+diff +menu -ruby +writebackup
+digraphs +mksession +scrollbind +X11
-dnd +modify_fname +signs +xfontset
-ebcdic +mouse +smartindent -xim
+emacs_tags -mouseshape +startuptime -xpm
+eval +mouse_dec +statusline +xsmp_interact
+ex_extra -mouse_gpm -sun_workshop +xterm_clipboard
+extra_search -mouse_jsbterm +syntax -xterm_save
+farsi +mouse_netterm +tag_binary
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/home/matt/.local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -ldl -L/home/matt/anaconda3/lib/python3.6/config-3.6m-x86_64-linux-gnu -lpython3.6m -lpthread -ldl -lutil -lrt -lm
我还通过gdb
运行了此编译实例,info shared
显示从我的anaconda目录加载了正确的libpython3.6
。我真的迷失了。谁能想到我失踪的东西?
答案 0 :(得分:0)
所以我今天处理同样的问题,我设法用
配置VIM编译来修复它--enable-python3interp=dynamic
我在https://github.com/Valloric/YouCompleteMe/issues/2855找到了建议。在我的网站上,我甚至不需要插入LD_LIBRARY_PATH
或类似的内容。