- Determine vim's python 3 location. From vim:
:py3 import os; print(os.__file__)
It will print something like: /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/os.py
- From a shell, set a convenience variable based on the above path (note the change from
lib/python3.7/os.py
tobin/python3
):
export VIMPY="/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/bin/python3"
$VIMPY -m ensurepip
# Install e.g. package1 and package2
$VIMPY -m pip install package1 package2
Best one.