前言
为什么要安装pyenv ?
便于python版本的管理和各模块的管理,以免造成冲突
pyenv官方地址:https://github.com/pyenv/pyenv
安装PyEnv
~]# yum install git -y
安装git
~]# yum groupinstall "Development Tools" -y
~]# yum -y install gcc make patch gdbm-devel openssl-devel sqlite-devel readline-devel zlib-devel bzip2-devel
安装开发包组
~]# useradd python
~]# echo "python"|passwd --stdin python
添加用户python
,修改密码为python
~]# su - python
切换到python
用户
~]$ curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
执行安装命令
export PATH="/home/python/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
将最后提示的复制粘贴进当前用户的环境变量文件.bash_profile
~]$ source .bash_profile
重载配置
安装完成