The idea of this post is to configure correctly the support of python3 on neovim, let’s start.
first this configuration is using macOS, by default python3 is installed on macOS and the default route of the executables are:
which python3 # => /usr/bin/python3
which pip3 # => /usr/bin/pip3
And that’s it! but normally if you are using homebrew you also installed the python3 using a formula, personally I do not to recomend that but it will work. you need to know where is installed that two executables.
Now we need to install the pynvim library:
pip3 install pynvim
# to upgrade (you already installed pynvim)
pip3 install --upgrade pynvim
# uninstall old version of neovim-python (maybe need this)
pip3 uninstall neovim
Now we edit the .vimrc
to enable python3 and disable python2
" Disable python2 support
let g:loaded_python_provider = 0
" Don't enable explicitly python3 it doesn't work and disables python3
" this only works for DISABLE, python3 is enabled by default
" let g:loaded_python3_provider = 1
" set the route of the executable
let g:python3_host_prog = '/usr/bin/python3'
" Explicitly tells to neovim use python3 when evaluate python code
set pyxversion=3
to ensure is correctly configured python3 launch neovim and run this command:
:checkhealth
And check the python3 support.
With this steps your setup it will run fine python3 and disable python2, currently all plugins supports python3.