Python virtualenv on a mac - smart-underworld/seestar_alp GitHub Wiki
Intro
NOTE This page has largely been made redundant by the mac/setup.sh
script. I'll leave it here for anyone who would like to do these steps manually - but going forward, that script will be the preferred mechanism for setup.
Python has the ability to run "virtual environments" - where different versions of python can be utilized for different parts of the filesystem.
At the time of writing this, the Raspberry Pi reference for seestar_alp runs on python version 3.12.5, where my mac runs on 3.9.11. Lets make it so the seestar_alp code runs on 3.12.5
Installing pyenv
First, we need to install the tools allowing us to virtualize python:
% curl https://pyenv.run | bash
Installing pyenv
Determine your shell:
% echo $SHELL
/bin/zsh
If you run zsh as your shell (the default), add the following to ~/.zprofile
If you run bash as your shell, add the following to ~/.bashrc
export PYENV_ROOT="$HOME/.pyenv"
[ -d $PYENV_ROOT/bin ](/smart-underworld/seestar_alp/wiki/--d-$PYENV_ROOT/bin-) && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Then, source that file to enable it in your running shell:
% source ~/.zprofile
Installing python 3.12.5
% pyenv install 3.12.5
Creating a virtualenv specific to SSC
% pyenv virtualenv 3.12.5 ssc-3.12.5
Activating the virtual env for SSC
% cd seestar_alp
% pyenv local ssc-3.12.5
Validate version, and install dependencies
% cd seestar_alp
% python --version
Python 3.12.5
% pip3 install -r requirements.txt