mac uses pyenv for Python version management
Previously are directly to the official website to download python3.4 pkg package to install, because to involve the modification of soft connections, it is very easy to go wrong. A recent attempt at pyenv to install. Install pyenv
Install
$ curl-l Https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | Bash
Update
$ pyenv Update
Uninstall
$ rm-fr ~/.pyenv
See:
Https://github.com/yyuu/pyenv-installer
The pyenv is now installed to the current user's ~/.pyenv directory.
Also, you need to copy the following code into ~/.BASHRC:
Export pyenv_root= "${home}/.pyenv"
If [-D "${pyenv_root}"]; Then
Export path= "${pyenv_root}/bin:${path}"
Eval "$ (pyenv init-)"
Fi
The function of this code is to indicate the location of the pyenv, so that you can run the pyenv command directly in the command line. It is saved in the ~/.BASHRC file to automatically take effect every time the user logs in.
So if you're running the order for the first time and you don't log off, this paragraph will not work, and we need to run the following order to make it effective:
SOURCE ~/.BASHRC installs Python and manages
See what versions of Python can be installed:
Pyenv Install--list
To install the 3.4.3 version of Python:
Pyenv Install 3.4.3
When you are finished installing, you can view the installation:
Pyenv versions
The results are as follows:
System
* 3.4.2 (set by/users/wxc/.pyenv/version)
3.4.3
* Represents the current Python version, and system represents the systems version.
Toggle Python version:
Pyenv Global 3.4.3
The results are as follows:
System
3.4.2
* 3.4.3 (set by/users/wxc/.pyenv/version)
You can see that the Python version has switched to 3.4.3 to perform the Python test successfully:
Python 3.4.3 (default, June 18 2015, 19:24:14)
[GCC 4.2.1 compatible Apple LLVM 5.1 (clang-503.0.40)] on Darwin
Type ' help ', ' copyright ', ' credits ' or ' license ' for the more information.
\>>>
If you want to cut back to the system version, enter:
PYENV Global System
If you want to uninstall a version of Python, enter:
Pyenv Uninstall 3.4.2