为什么 Vim 运行 python2 而它使用 +python3 编译?


vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 17:31:41)
Included patches: 1-1453
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version without GUI.  Features included (+) or not (-):
+comments          +libcall           -python            +vreplace
+conceal           +linebreak         +python3           +wildignore

我忽略了列表中的其他人,只显示 -python 和 + python3。

$ python --version
Python 3.6.9

在 vim 中,我得到了:

$vim test.py    
:!python --version
Python 2.7.17

当你这样做:!cmd你是在外壳上运行cmd。这与 vim 没有太大关系。要检查 python vim 内部使用的是哪个版本的 python,请在 vim 内部:python3 import sys; print(sys.version)

最新更新