Skip to content

Instantly share code, notes, and snippets.

@tommct
Last active April 29, 2024 18:29
Show Gist options
  • Save tommct/05db3c414b02b3d66f032498d7307186 to your computer and use it in GitHub Desktop.
Save tommct/05db3c414b02b3d66f032498d7307186 to your computer and use it in GitHub Desktop.
Install Python MacOS 14, Pyenv

This borrows from https://jordanthomasg.medium.com/python-development-on-macos-with-pyenv-2509c694a808.

Install Homebrew if necessary.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Before installing pyenv do the following:

brew install openssl readline sqlite3 xz zlib tcl-tk

For HuggingFace models (and maybe for other ML models and things to work correctly), install the following before python.

brew install git-lfs
brew install xz

Install pyenv.

brew install pyenv 

Add pyenv initializer to shell startup script

echo 'eval "$(pyenv init -)"' >> ~/.zshrc

Reload your profile.

source ~/.zshrc

List possible pyenv versions.

pyenv install -l

Install a particular version.

pyenv install 3.12.2

Set it to be the global python.

pyenv global 3.12.2

Install packages for Machine Learning

pip install --upgrade pip
pip install -U numpy
pip install -U pandas
pip install -U pyarrow
pip install -U matplotlib
pip install -U seaborn
pip install "altair[all]"
pip install -U scipy
pip install -U scikit-learn
pip install -U streamlit
pip install -U tqdm
pip install -U jupyterlab
pip install -U notebook
pip install -U ipywidgets
pip install -U torch
pip install -U torchvision
pip install -U pytorch-lightning
pip install -U lightning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment