When use vim's insert mode, it happened:
/home/user/.vim/plugged/ultisnips/autoload/UltiSnips.vim Error:
E319: Sorry, can't use: py3 import vim
Because now using this plugin:
Plug 'SirVer/ultisnips'
I installed Python3
by pyenv
.
$ pyenv versions
system
* 3.9.1 (set by /home/user/.pyenv/version)
$ which python
/home/user/.pyenv/shims/python
$ python -V
Python 3.9.1
When use macOS, set these items into ~/.vimrc
can resolve the problem:
set pythonthreedll=/usr/local/Frameworks/Python.framework/Versions/3.9/Python
set pythonthreehome=/usr/local/Frameworks/Python.framework/Versions/3.9
But on Ubuntu, how to find pythongthreehome
and pythonthreedll
path? I tried to set /home/user/.pyenv/shims/python
, not work.
The problem is most likely that you have a Vim package without Python enabled.
You can tell that from the vim --version
output (or :version
inside Vim.) If it says +python3
or +python3/dyn
, then it means Python is enabled. On the other hand, if it says -python3
, then it doesn't.
If your Vim has Python disabled, you will need to install a different Vim package. On Ubuntu or Debian, you could use apt-get install vim-nox
to install a Vim package which has Python enabled.