Vim - setting for python3 support but still showing -python3 in version info
I am trying to build a vim on Ubuntu 12.04 with python3 support as the default installation has python2 support. I am pulling the source code from https://vim.googlecode.com/hg/ and setting it up like this:
./configure --disable-pythoninterp --enable-python3interp --with-features huge
I also tried using the --enable-pythoninterp option.
When I run vim -version on this installation, I still get -python3 like this:
$ ./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
As you can see from the above, python3 support is not included in the binary.
I also have python3-dev installed, although I'm sure this is necessary.
sudo apt-get install python3-dev
Any help would be greatly appreciated!
thank
source to share
You also need to specify the python config directory with
--with-python3-config-dir=
when running configure as it seems that configure was unable to find the directory automatically.
Another way to do configure is to find that python3-config-dir will automatically make sure to python
point to the python 3 executable and not python 2 (which is the default on most systems)
I would also recommend running configure with --enable-fail-if-missing
so that the configure script crashes instead of quietly warning that it did not find the config directory or the python3 executable.
source to share
Vim building from source
- Install all required libraries first, including Mercurial. For a Linux distribution like Linux such as Ubuntu, this would be:
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
For Fedora 20, this would be:
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
- Remove vim if you already have it.
bash
sudo apt-get remove vim vim-runtime gvim vim-tiny vim-common vim-gui-common
- Once everything is set, getting the source is easy. If you are not using vim 7.4, make sure you have specified the VIMRUNTIMEDIR variable correctly (for example, with vim 7.4a, use / usr / share / vim / vim 74a):
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
- Set vim as your default editor with
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
Done
source to share