【发布时间】:2018-01-28 05:54:26
【问题描述】:
我很难让 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 显示正确的libpython3.6 是从我的anaconda 目录加载的。我真的迷失了。谁能想到我缺少的东西?
【问题讨论】:
标签: python python-3.x vim compilation