python3 安装
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 gcc
mkdir -p /data/server/python
cd /data/server/python
wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
# 3.7版本之后需要一个新的包libffi-devel
yum install libffi-devel -y
# 解压 到指定目录
tar zxvf Python-3.7.9.tgz
# 生成编译脚本(指定安装目录)
cd Python-3.7.9
./configure --prefix=/data/server/python
# 编译
make & make install
# 运行
/data/server/python/bin/python3.7
#pip3
/data/server/python/bin/pip3 install tornado
#卸载
pip3 uninstall xxx
#更新
pip3 install xxxx -U
#查看已安装的包
pip3 list
# 添加软连接
ln -s /data/server/python/bin/python3 /usr/bin/python3
ln -s /data/server/python/bin/pip3 /usr/bin/pip3
修改pip源
mkdir ~/.pip
cd ~/.pip
vi pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
还没有评论,来说两句吧...