When I thought that I would start programming on my first Mac, I immediately got stuck in building an environment, so as a memo
Mostly because of zsh: rage: Since the standard shell has changed from bash to zsh from Catallina, there is a problem that the path does not pass when following the article searched in Tekito. If there is a difference in the shell configuration file name and you refer to the article using bash
.bash_profile
→ .zprofile
.bashrc
→ .zshrc
Need to replace
Mac has an old version of python (2 series) as standard 2 series is different from the latest version python (3 series), so it is better to switch This time, switch the python version with a tool called pyenv.
Execute the following command in the shell If brew is not installed, install brew first
brew install pyenv
After installation, post the following to .zshrc
to pass the path
Create if .zshrc
does not exist
.zshrc
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
~
Execute the following command to save and reload .zshrc
source ~/.zshrc
This completes the installation, run pyenv --version
and make sure it is in your path
Run the following command to see a list of python versions that can be installed with pyenv
pyenv install --list
Select the version you want to use from there and install Select 3.8.0 this time
pyenv install 3.8.0
After installation, switch the standard python with the following command The second is a command that applies switching only to the current directory
pyenv python global 3.8.0
pyenv python local 3.8.0
After switching, check the python version with python --version
Success if changed to any version
-Installing and using pyenv, what to do if you can't switch python versions
Recommended Posts