Zane Hitchcox
Zane Hitchcox

Reputation: 936

add python support to vim

So, I've tried the instructions here, and they don't seem to work. One problem could be the config directory specified in the instructions is wrong, so I change the configuration instructions to

cd ~
git clone https://github.com/vim/vim.git
cd vim
./configure --with-features=huge \
                            --enable-multibyte \
                            --enable-rubyinterp=yes \
                            --enable-pythoninterp=yes \
                            --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
                            --enable-python3interp=yes \
                            --with-python3-config-dir=/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu \
                            --enable-perlinterp=yes \
                            --enable-luainterp=yes \
                            --enable-gui=gtk2 \
                            --enable-cscope \
                            --prefix=/usr/local
make VIMRUNTIMEDIR=/usr/local/share/vim/vim80

which accurately reflects my config directories. I have also verified that I have python installed on my command line, and python3, although, I'm not sure if they're the same versions used in the config file that I provided and don't know how to check that.

When I type vim --version, I get the following output:

vim $ vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul  2 2018 14:51:11)
Included patches: 1-137
Compiled by zane@tiki
Huge version without GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          -toolbar
+cindent           +insert_expand     +path_extra        +user_commands
-clientserver      +job               -perl              +vartabs
-clipboard         +jumplist          +persistent_undo   +vertsplit
+cmdline_compl     +keymap            +postscript        +virtualedit
+cmdline_hist      +lambda            +printer           +visual
+cmdline_info      +langmap           +profile           +visualextra
+comments          +libcall           +python/dyn        +viminfo
+conceal           +linebreak         +python3/dyn       +vreplace
+cryptv            +lispindent        +quickfix          +wildignore
+cscope            +listcmds          +reltime           +wildmenu
+cursorbind        +localmap          +rightleft         +windows
+cursorshape       -lua               -ruby              +writebackup
+dialog_con        +menu              +scrollbind        -X11
+diff              +mksession         +signs             -xfontset
+digraphs          +modify_fname      +smartindent       -xim
-dnd               +mouse             +startuptime       -xpm
-ebcdic            -mouseshape        +statusline        -xsmp
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_clipboard
+eval              -mouse_gpm         +syntax            -xterm_save
+ex_extra          -mouse_jsbterm     +tag_binary        
+extra_search      +mouse_netterm     +tag_old_static    
   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: "/usr/local/share/vim"
 f-b for $VIMRUNTIME: "/usr/local/share/vim/vim80"
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        -lm -ltinfo -lnsl    -ldl   

You can see that python is checked for dynamically (even though I do not want that, but don't know how to change it). And when I try :echo has('python') or :echo has('python3'), both come back 0.

I'm wondering how I can correctly install vim with python and what I'm doing wrong.

Upvotes: 1

Views: 7749

Answers (1)

Zane Hitchcox
Zane Hitchcox

Reputation: 936

I needed to install python-dev and python3-dev

For convenience:

sudo apt install python-dev python3-dev -yqq

Upvotes: 2

Related Questions