一、Git克隆方式
1.安装git
yum -y install git
2.克隆pyenv到本地
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
3.配置环境变量
1 [root@localhost ~]# echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile 2 [root@localhost ~]# echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile 3 [root@localhost ~]# source .bash_profile 4 [root@localhost ~]# pyenv --version 5 pyenv 1.2.9-32-g64c0828
4.pyenv初始化到当前用户shell
eval "($pyenv init -)"
5.重启shell并开始使用pyenv
[root@localhost ~]# exec "$SHELL" [root@localhost ~]# pyenv -h Usage: 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 executable
6.安装python之前相关依赖包的安装
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y