在python中添加python支持

时间:2018-07-02 18:58:34

标签: python vim

因此,我尝试了here的说明,但它们似乎没有用。一个问题可能是说明中指定的配置目录错误,所以我将配置说明更改为

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

可以准确反映我的配置目录。我还验证了我在命令行上安装了python,还是在python3上安装了Python3,但我不确定它们是否与我提供的配置文件中使用的版本相同,并且不知道如何进行检查。 / p>

当我输入vim --version时,得到以下输出:

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   

您可以看到python是动态检查的(即使我不希望这样做,但也不知道如何更改它)。当我尝试使用:echo has('python'):echo has('python3')时,两者都返回0

我想知道如何使用python正确安装vim以及我做错了什么。

1 个答案:

答案 0 :(得分:2)

我需要安装python-dev和python3-dev

为方便起见:

sudo apt install python-dev python3-dev -yqq