Skip to content

Instantly share code, notes, and snippets.

@kunalarya
Last active October 26, 2023 13:58
Show Gist options
  • Save kunalarya/acd12e15b0c004aa55a7300a165f2334 to your computer and use it in GitHub Desktop.
Save kunalarya/acd12e15b0c004aa55a7300a165f2334 to your computer and use it in GitHub Desktop.
Using pip to install packages for vim's python 3 on Mac
  1. 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

  1. From a shell, set a convenience variable based on the above path (note the change from lib/python3.7/os.py to bin/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
@Constantin1489
Copy link

Constantin1489 commented Oct 26, 2023

Best one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment