CentOS 7 安装最新版Python3 & PIP换源、配置代理
CentOS 7 安装最新版Python3
安装编译和运行所需组件
yum -y install gcc zlib zlib-devel libffi libffi-devel readline-devel openssl-devel openssl11 openssl11-devel
设置编译FLAG,以便使用最新的openssl库
export CFLAGS=$(pkg-config --cflags openssl11)
export LDFLAGS=$(pkg-config --libs openssl11)
编译安装
./configure --prefix=/usr/local/python3 --with-ssl
make
make install
创建链接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
pip换源、配置代理
清华源pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
阿里源pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
腾讯源pip config set global.index-url http://mirrors.cloud.tencent.com/pypi/simple
源配置文件/root/.config/pip/pip.conf
配置代理
示例pip install requests --proxy=127.0.0.1:8080