2014-10-18 23 views
3

我想在Ubuntu 12.04上搭建python3支持vim,因为默认安装只支持python2。我拉从https://vim.googlecode.com/hg/的源代码和配置,像这样:vim - 配置python3的支持,但仍显示-python3的版本信息

./configure --disable-pythoninterp --enable-python3interp --with-features huge 

我与--enable-pythoninterp选项也试过。

当我运行该VIM --version安装我仍然得到-python3像这样:

$ ./src/vim --version 
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Oct 18 2014 09:32:02) 
Included patches: 1-481 
Compiled by [email protected] 
Normal version with GTK2 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   +viminfo 
-cscope   +lispindent  -python3   +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: "/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/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/harfbuzz  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1  
Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl  

正如可以在上面,python3支持被看作是不包含在二进制文件。

我也安装了python3-dev,虽然我确定如果这是必需的。

sudo apt-get install python3-dev 

任何帮助将不胜感激!

感谢

回答

2

您还需要配置运行时,因为它看起来配置无法自动找到目录与

--with-python3-config-dir= 

指定蟒蛇配置目录。


的另一种方法,使配置自动发现python3-配置-dir是确保python指向一个python 3可执行文件,而不是蟒蛇2一个(大多数系统默认)


我也建议使用--enable-fail-if-missing运行configure,这样配置脚本就会失败,而不是悄悄地警告它没有找到python3 config目录或可执行文件。

3

Vim的建设从源头

  • 首先,安装所有必备库,包括水银。对Debian像Linux发行版如Ubuntu,这将是如下:

bash sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \ libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \ libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \ ruby-dev mercurial 于Fedora 20,这将是以下几点:

bash sudo yum install -y ruby ruby-devel lua lua-devel luajit \ luajit-devel ctags mercurial python python-devel \ python3 python3-devel tcl-devel \ perl perl-devel perl-ExtUtils-ParseXS \ perl-ExtUtils-XSpp perl-ExtUtils-CBuilder \ perl-ExtUtils-Embed

  • 删除VIM如果你有它已经。

bash sudo apt-get remove vim vim-runtime gvim vim-tiny vim-common vim-gui-common

  • 一旦安装了一切,获得源很容易。如果你没有使用vim 7.4,请确保在下面正确设置VIMRUNTIMEDIR变量(例如,使用vim 7。4A,使用/ usr/share/vim目录/ vim74a):

bash cd ~ hg clone https://code.google.com/p/vim/ cd vim ./configure --with-features=huge \ --enable-multibyte \ --enable-rubyinterp \ --enable-python3interp vi_cv_path_python3=/usr/bin/python3.4 \ --with-python-config-dir=/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu \ --enable-perlinterp \ --enable-luainterp \ --enable-gui=gtk2 --enable-cscope --prefix=/usr make VIMRUNTIMEDIR=/usr/share/vim/vim74 sudo apt-get install checkinstall sudo checkinstall

  • 设置vim作为您的默认编辑器update-alternatives

bash sudo update-alternatives --install /usr/bin/editor editor /usr/bin/vim 1 sudo update-alternatives --set editor /usr/bin/vim sudo update-alternatives --install /usr/bin/vi vi /usr/bin/vim 1 sudo update-alternatives --set vi /usr/bin/vim

完成