Python

https://docs.python-guide.org/starting/install3/osx

Setup

Path Settings

if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
alias python=/opt/homebrew/bin/python3

using pipenv

pipenv has virtual environment management built in so that you have a single tool for your package management.

https://realpython.com/pipenv-guide

Once you’ve done that, you can effectively forget about pip since Pipenv essentially acts as a replacement. It also introduces two new files, the Pipfile (which is meant to replace requirements.txt) and the Pipfile.lock (which enables deterministic builds).

Pipenv uses pip and virtualenv under the hood but simplifies their usage with a single command line interface.

  1. create project folder
    cd project_folder
  2. pipenv install requests
  3. $pipenv shell
    • should see the pipenv name at the beginning of line prompt

direnv

When you cd into a directory containing a .env, direnv automagically activates the environment.

Install it on Mac OS X using brew:

$ brew install direnv

https://docs.python.org/3/using/mac.html


Discover more from Slow and Faithful

Subscribe to get the latest posts to your email.