If you are new to Python and want to change the default version! I think it will be useful in such a case. It took a lot of time when I tried to change Python to 3 series.
Here, we will use a tool called pyenv. I think it is very convenient because you can easily switch to the 2nd system again.
$ python -V
Python 2.7.10
$ brew update
#Update Homebrew
$ brew install pyenv
#Install pyenv
$ pyenv install --list
#Command to display a list of installable versions
$ pyenv install 3.5.6
#Perform Python installation
$ pyenv versions
* system
3.5.6 (set by $HOME/.pyenv/version)
$ pyenv global 3.5.6
#Specify the global version
--But with python -V, the first version is still displayed
$ python -V
Python 2.7.10
--Execute eval "$ (pyenv init-)" to reflect the changes
$ eval "$(pyenv init -)"
#By running pyenv init,$HOME/.pyenv/version)Applies by adding the Path of the environment variable to the Path of the environment variable
% python -V
Python 3.5.6
You can change it at any time by selecting the version using the [pyenv global version] command. I don't know how eval "$ (pyenv init-)" works, so I have to learn more. .. It's very convenient, but I'm still not familiar with it, so I'd like to dig a little deeper.
Recommended Posts