我正在尝试使用python3支持在Ubuntu 12.04上构建vim,因为默认安装只支持python2。我从https://vim.googlecode.com/hg/中提取源代码并进行如下配置:
./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 brendan@brendan-laptop
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
非常感谢任何帮助!
由于
答案 0 :(得分:3)
您还需要使用
指定python配置目录--with-python3-config-dir=
运行configure时,因为配置似乎无法自动查找目录。
使configure自动查找python3-config-dir的另一种方法是确保python
指向python 3可执行文件而不是python 2可执行文件(大多数系统默认为)
我还建议使用--enable-fail-if-missing
运行configure,以便配置脚本失败,而不是静静地警告它没有找到python3配置目录或可执行文件。
答案 1 :(得分:3)
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
bash
sudo apt-get remove vim vim-runtime gvim vim-tiny vim-common vim-gui-common
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
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
完成