我最近安装了 Ubuntu 16.04,并且在发行说明它说
VIM 默认使用 python3
在全新安装的 Ubuntu 16.04 上,我使用以下命令安装了 vim
$ python3 -V
Python 3.5.1+
$ vim
The program 'vim' can be found in the following packages:
vim
...
$ sudo apt install vim
$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Apr 08 2016 11:38:28)
Included patches: 1-1689
Modified by [email protected]
Compiled by [email protected]
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +tag_binary
+arabic +file_in_path +mouse_sgr +tag_old_static
+autocmd +find_in_path -mouse_sysmouse -tag_any_white
-balloon_eval +float +mouse_urxvt -tcl
-browse +folding +mouse_xterm +terminfo
++builtin_terms -footer +multi_byte +termresponse
+byte_offset +fork() +multi_lang +textobjects
+channel +gettext -mzscheme +timers
+cindent -hangul_input +netbeans_intg +title
-clientserver +iconv +packages -toolbar
-clipboard +insert_expand +path_extra +user_commands
+cmdline_compl +job -perl +vertsplit
+cmdline_hist +jumplist +persistent_undo +virtualedit
+cmdline_info +keymap +postscript +visual
+comments +langmap +printer +visualextra
+conceal +libcall +profile +viminfo
+cryptv +linebreak -python +vreplace
+cscope +lispindent -python3 +wildignore
+cursorbind +listcmds +quickfix +wildmenu
+cursorshape +localmap +reltime +windows
+dialog_con -lua +rightleft +writebackup
+diff +menu -ruby -X11
+digraphs +mksession +scrollbind -xfontset
-dnd +modify_fname +signs -xim
-ebcdic +mouse +smartindent -xsmp
+emacs_tags -mouseshape +startuptime -xterm_clipboard
+eval +mouse_dec +statusline -xterm_save
+ex_extra +mouse_gpm -sun_workshop -xpm
+extra_search -mouse_jsbterm +syntax
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl
$ vim --version | grep python
+cryptv +linebreak -python +vreplace
+cscope +lispindent -python3 +wildignore
我知道我可以从源代码构建,但我想知道我是否缺少一些东西来获得用于脚本的 python3 功能。
谢谢
答案1
删除 vim 并安装 vim-nox,因为您不需要 GUI。
sudo apt-get install vim-nox
答案2
我必须确保 vim 已从我的系统中完全删除,方法是删除
ii vim-common
ii vim-runtime
ii vim-gtk
ii vim-gui-common
ii vim-tiny
诚然,其中一些软件包是在尝试安装 vim-gnome 和 vim-nox 时添加的。因此您的系统可能没有安装所有这些软件包。您可以通过运行来检查
dpkg-query -l | grep vim
一旦所有这些都被删除,我通过使用 Py2 安装 nox 成功添加了带有 Python2 解释器的 Vim
sudo apt-get update && sudo apt-get install vim-nox-py2
答案3
删除 vim 并安装 vim-gnome。
sudo apt-get install vim-gnome