First download pyenv the corresponding one-click installation script to GitHub,
$ curl-l Https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | Bash
After installation, setting environment variables, setting environment variables, can be added to the personal home directory of the. bashrc or. Bash_profile and the system's full
Bureau of/etc/profile,
# Load pyenv automatically by adding# the following to ~/.bash_profile:export path= "/home/lavenliu/.pyenv/bin: $PATH" eval "$ (pyenv init-)" eval "$ (pyenv virtualenv-init-)"
Once setup is complete, you can verify it at the command line,
[[email protected]_113_230_centos ~]$ . ~/.bash_profile [[email Protected]_113_230_centos ~]$ pyenv pyenv 20160726usage: pyenv <command> [<args>]Some useful pyenv commands are: commands List all available pyenv commands local Set or show the local application-specific Python Version global set or show the global Python version shell Set or show the shell-specific python version install Install a Python version using python-build uninstall uninstall a specific python version rehash rehash pyenv shims (run this after installing executables) version Show the current Python version and its Origin versions list all python versions available to pyenv which display the full path to an executable whence list all Python versions that contain the given executableSee ' pyenv help <command> ' for information on a specific command. For full documentation, see: https://github.com/yyuu/pyenv#readme
None of the above is a problem. For example, install a 3.5.2 version of Python,
Pyenv Install 3.5.2
If the download speed is slow, you can download it in advance and put it in the ~/.pyenv/cache directory. Modify the ~/.pyenv/plugins/python-build/share/python-build/3.5.2 file,
Cat ~/.pyenv/plugins/python-build/share/python-build/3.5.2#require_gccinstall_package "openssl-1.0.2g" "https:// Www.openssl.org/source/openssl-1.0.2g.tar.gz#b784b1b3907ce39abf4098702dade6365522a253ad1552e267a9a0e89594aa33 " Mac_openssl--if has_broken_mac_opensslinstall_package "readline-6.3" "http://ftpmirror.gnu.org/readline/ Readline-6.3.tar.gz#56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43 "Standard--if Has_broken_ Mac_readlineif Has_tar_xz_support; Then Install_package "Python-3.5.2", "~/.pyenv/cache/python-3.5.2.tar.gz" Ldflags_dirs standard verify_py35 Ensurepipelse install_package "Python-3.5.2" "~/.pyenv/cache/python-3.5.2.tar.gz" Ldflags_dirs standard verify_py35 Ensurepipfi
Because there is no ~/.pyenv/cache directory, it is created manually,
$ mkdir ~/.pyenv/cache
If you use manual installation, you need to install some dependencies,
# yum install-y gcc make patch gdbm-devel openssl-devel sqlite-devel zlib-devel bzip2-devel readline-devel
The python-3.5.2.tar.gz installation package needs to be prepared in advance and placed in the ~/.pyenv/cache directory. Then, use the Pyenv install 3.5.2 directly on the command line,
$ pyenv Install 3.5.2
After installation, use the version command to view the
Pyenv version3.5.2 (set by/home/lavenliu/.python-version)
At this point, the installation is complete.
This article is from the "solid-state Drive" blog, make sure to keep this source http://lavenliu.blog.51cto.com/5060944/1836500
PYENV environment construction of python development environment