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

I have ignored others in the list by just showing the -python and + python3.

$ python --version
Python 3.6.9

While in the vim I got:

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

1 Answer 1

2

When you do :!cmd you are running cmd on the shell. This has not much to do with vim. To check which version of python vim is using internally do :python3 import sys; print(sys.version) inside vim.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks @blues. :python import sys; print(sys.version) still shows python2 is the default. 2.7.17 (default, Nov 7 2019, 10:07:09) [GCC 7.4.0] . Some suggestions for setting Pyhon3 as default?
You need to actually specify :python3 with the 3.
Solved by nnoremap <buffer> <F9> :exec '!python3' shellescape(@%, 1)<cr> in .vimrc

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.