RedHat7.6 yum source配置
源码安装Python3.7
安装依赖环境
# ROOT
yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
yum install libffi-devel -y
获取Python包并解压
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
tar -xvJf Python-3.7.0.tar.xz
编译安装
mkdir /usr/local/python3 #创建编译安装目录
cd Python-3.7.0
./configure --prefix=/usr/local/python3
make && make install
创建软连接
ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
验证是否成功
python3 -V
pip3 -V
从 Github 克隆 pyenv 仓库
# 打开终端输入
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
修改 PATH 环境变量
vim ~/.bash_profile
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
最后 source ~/.bash_profile
从 Github 克隆 pyenv-virtualenv 仓库
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
配置
vim ~/.bash_profile
eval "$(pyenv virtualenv-init -)"
最后 source ~/.bash_profile
原文访问: python源码安装和pyenv + Virtualenv