pyenv is a tool that uses multiple versions of python properly. I think it will be convenient later to install python using pyenv.
pyenv is a tool that uses multiple versions of Python. When using python, it is convenient to install pyenv first.
Copy the command below and paste it into your terminal Enter
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Execute the following command in the terminal
brew install pyenv
Copy and execute the following command line by line in the terminal
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
Apply the contents written in zshrc
source ~/.zshrc
For OS older than Catalina: Copy and execute the following command line by line in the terminal
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
Apply the contents written in bash_profile
source ~/.bash_profile
Install the same version that was included by default
pyenv install 3.7.3
For some reason, you may have a python-version in your home directory. If there is this, it can not be switched, so delete it with the following command
rm ~/.python-version
Version switching
pyenv global 3.7.3
List of versions that can be installed
pyenv install --list
Installed version and currently in use version (currently in use marked with *)
pyenv versions
Recommended Posts