1 Installing Pyenv
Brew Install Pyenv
2 Configuring ~/bash_profile
Export pyenv_root= "$HOME/.pyenv" Export path= "$PYENV _root/bin: $PATH" eval "$ (pyenv init-)"
3 Let the new configuration item take effect
SOURCE ~/.bash_profile
4 test if it is installed and view the version that can be installed
Pyenv install-l
5 Installing Python3
My current latest version of Python is 3.6.4. You can install it according to the latest version shown in the previous code.
Pyenv Install 3.6.4
6 switch version to 3.6.4
$ pyenv Global 2.7.3 # Sets the global Python version by writing the version number to the ~/.pyenv/version file. $ pyenv Local 2.7.3 # Sets the Python native version by writing the version number to the. python-version file in the current directory. The Python version set in this way has a higher priority than global.
7 printing the current Python version
Import Sys
Print (sys.version)
Print (Sys.version_info)
Mac OS uses pyenv to manage Python multiple versions