A tool that allows you to easily switch between multiple Python versions
Homebrew is a package manager for macOS, and it is necessary to install pyenv, so install it. If you use Homebrew, you can put php, mysql, etc. in addition to pyenv. Homebrew official page: https://brew.sh/index_ja
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
pyenv is a python version control tool.
brew install pyenv
Edit bash_profile to pass the path. You can add the path by executing all the commands below.
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
To install the python version with pyenv, run pyenv install version
to install. Since 3.6 will be installed this time, execute the following command.
pyenv install 3.6.0
pyenv global 3.6.0
Installing and using pyenv, what to do when you cannot switch the python version
Recommended Posts