# Installing python on MacOS The Right Way To completely avoid the MacOS python, start with brew or macport. If you start with macports, you will not be using that python version for much (ideally). But we need some, somewhat isolated python to start with. ``` sudo port install python38 sudo port install py38-pip sudo port select --set python python38 sudo port select --set pip pip38 sudo port select --set python3 python38 # One terrible feature of macport's version is that you can # select and upgrade the python version and pip versions separately. # This means you can be using the using .../bin/python38 but the pip is installing elsewhere #alias pipx=/Users/aberezin/Library/Python/3.8/bin/pipx sudo pip install virtualenv sudo pip install virtualenvwrapper #dont know why the wrapper is here but I symlink it to better place mkdir -p ~/.local/bin ln -s /opt/local/Library//Frameworks/Python.framework/Versions/3.8/bin/virtualenvwrapper.sh ~/.local/bin/virtualenvwrapper.sh #I am also going to install virtualenv here #But pipx should be used sparingly since it adds a layer of complexity #I am only using it to exec virtualenv pip install pipx #now make it hard to use pip outside a virtualenv export PIP_REQUIRE_VIRTUALENV=1 mkvirtualenv py38 ```