Installing and setting up a decent Python configuration in MacOS 10.11
Before I took these steps, I ran
brew uninstall python in an attempt to clear out a different Python installation. I also had to clear out some stuff in my
- Install Pyenv via Homebrew:
brew update && brew install pyenv
- Add stuff to .bash_profile:
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
- Restart terminal.
- Maybe install dependencies? (You may be good to go already.)
pyenv install --listand pick new-ish-but-stable versions of python2 and python3 to install. For example:
pyenv install 3.7.0 2.7.15
- You can set version 3 as the global, with 2 as fall-back:
pyenv global 3.7.0 2.7.15. You can also set your
system's Python as a secondary fallback by running
pyenv global 3.7.0 2.7.15 system.