Skip to content

Instantly share code, notes, and snippets.

@andyneff
Last active December 11, 2018 21:56
Show Gist options
  • Select an option

  • Save andyneff/0dd6c72e0feee05a6b4ac6188ac3317d to your computer and use it in GitHub Desktop.

Select an option

Save andyneff/0dd6c72e0feee05a6b4ac6188ac3317d to your computer and use it in GitHub Desktop.
Cleanly add pipenv to OS
#!/usr/bin/env bash
set -eu
TMP_DIR="$(mktemp -d)"
python3 <(curl -L https://bootstrap.pypa.io/get-pip.py) --no-cache-dir -I --root "${TMP_DIR}" virtualenv
sudo env PYTHONPATH="$(cd "${TMP_DIR}"/usr/local/lib/python*/*-packages/; pwd)" "${TMP_DIR}/usr/local/bin/virtualenv" "/usr/local/pipenv/"
sudo /usr/local/pipenv/bin/pip install --no-cache-dir pipenv
sudo ln -s /usr/local/pipenv/bin/pipenv /usr/local/bin
sudo bash -c "echo \"/usr/local/pipenv/bin/pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs /usr/local/pipenv/bin/pip install -U\" > /usr/local/pipenv/bin/update"
sudo chmod 754 /usr/local/pipenv/bin/update
rm -r "${TMP_DIR}"
@andyneff
Copy link
Author

andyneff commented Dec 11, 2018

Now it adds the script /usr/local/pipenv/bin/update you can run as root to update the pipenv install and all of its dependencies for you.

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