简体   繁体   English

在python中添加python支持

[英]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. 我还验证了我在命令行和python3上安装了python,但是,我不确定它们是否与我提供的配置文件中使用的版本相同,并且不知道如何进行检查。

When I type vim --version , I get the following output: 当我输入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   

You can see that python is checked for dynamically (even though I do not want that, but don't know how to change it). 您可以看到python是动态检查的(即使我不希望这样做,但也不知道如何更改它)。 And when I try :echo has('python') or :echo has('python3') , both come back 0 . 当我尝试:echo has('python'):echo has('python3') ,两者都返回0

I'm wondering how I can correctly install vim with python and what I'm doing wrong. 我想知道如何使用python正确安装vim,以及我在做什么错。

I needed to install python-dev and python3-dev 我需要安装python-dev和python3-dev

For convenience: 为了方便:

sudo apt install python-dev python3-dev -yqq

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM