vim:无法加载库libpython

时间:2015-12-16 10:08:43

标签: python vim

我没有得到vim来使用python支持。我使用以下配置编译vim 7.4.972:

./configure --enable-shared --with-features=huge --enable-multibyte --enable-cscope
    --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-python3interp=yes
    --enable-perlinterp=yes --enable-luainterp=yes --enable-gui=auto
    --enable-gtk2-check --enable-gnome-check --prefix=/home/me/tools/
    --with-global-runtime=/home/me/tools/share/vim/vim74 --with-lua-prefix=/home/me/tools
    --with-luajit --enable-fail-if-missing -with-x | tee vim_conf.log

关于python的输出是:

checking --enable-pythoninterp argument... yes
checking for python2... /sw/python/anaconda/bin/python2
checking Python version... 2.7
checking Python is 2.3 or better... yep
checking Python's install prefix... /sw/python/anaconda
checking Python's execution prefix... /sw/python/anaconda
checking Python's configuration directory... /sw/python/anaconda    /lib/python2.7/config
checking if -pthread should be used... yes
checking if compile and link flags for Python are sane... yes
checking --enable-python3interp argument... yes
checking for python3... /sw/python/anaconda3-2.2.0/bin/python3
checking Python version... 3.4
checking Python is 3.0 or better... yep
checking Python's abiflags... m
checking Python's install prefix... /sw/python/anaconda3-2.2.0
checking Python's execution prefix... /sw/python/anaconda3-2.2.0
checking Python's configuration directory... /sw/python/anaconda3-2.2.0    /lib/python3.4/config-3.4m
checking if -pthread should be used... yes
checking if compile and link flags for Python 3 are sane... yes
checking whether we can do without RTLD_GLOBAL for Python... yes
checking whether we can do without RTLD_GLOBAL for Python3... yes

vim --version显示:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 16 2015 10:47:42)
Included patches: 1-972
Compiled by ziereisen@l57
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
+balloon_eval    +float           +mouse_urxvt     -tag_any_white
+browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
+clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      +toolbar
+cmdline_compl   +insert_expand   +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      -sniff           +xsmp_interact
+eval            +mouse_dec       +startuptime     +xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    +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: "/home/ziereisen/tools/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12   -DORBIT2=1 -pthread -I/usr/include/libgnomeui-2.0 -I/usr/include/libgnome-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gtk-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/libbonoboui-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib64/gnome-vfs-2.0/include -I/usr/include/gnome-keyring-1 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/libpng12 -I/usr/include/libxml2     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc -L/lib64    -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/sw/perl5/lib/5.8.8/x86_64-linux-thread-multi-ld/CORE   -L/usr/local/lib -Wl,--as-needed -o vim   -L/lib64 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0   -L/lib64   -lgnomeui-2 -lSM -lICE -lbonoboui-2 -lgnome-keyring -lxml2 -lz -lgnomecanvas-2 -lgnome-2 -lpopt -lart_lgpl_2 -lpangoft2-1.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lbonobo-2 -lgnomevfs-2 -lbonobo-activation -lgconf-2 -lgobject-2.0 -lORBit-2 -lm -lgmodule-2.0 -ldl -lgthread-2.0 -lglib-2.0   -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -lncurses -lelf -lnsl  -lselinux   -lacl -lattr -lgpm  -L/home/ziereisen/tools/lib -lluajit-5.1 -Wl,-E -Wl,-rpath,/sw/perl5/lib/5.8.8/x86_64-linux-thread-multi-ld/CORE  -L/usr/local/lib /sw/perl5/lib/5.8.8/x86_64-linux-thread-multi-ld/auto/DynaLoader/DynaLoader.a -L/sw/perl5/lib/5.8.8/x86_64-linux-thread-multi-ld/CORE -lperl -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc    -lruby -lpthread -ldl -lcrypt -lm  -L/usr/lib64   

但是,如果我启动vim并尝试命令py print(1)或py3 print(1),我总会收到消息:

E370: Could not load library libpython2.7.so.1.0
E263: Sorry, this command is disabled, the Python library could not be loaded.

E370: Could not load library libpython3.4m.so.1.0
E263: Sorry, this command is disabled, the Python library could not be loaded.

我没想到问题是什么。我用Google搜索,但没有找到任何解决方案。我希望有人能给我一个提示。

此致

MAIK

1 个答案:

答案 0 :(得分:1)

尝试将lib目录添加到/etc/ld.so.conf并运行ldconfig。另一种可能的解决方案可能是将目录添加到LD_LIBRARY_PATH环境变量中。                      - 詹森