Python教程

CENTOS离线环境安装python3.9.5

本文主要是介绍CENTOS离线环境安装python3.9.5,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1、准备一台链接外网的centos,下载python3依赖包到路径:/home/python3/

mkdir /home/python3/
yumdownloader --resolve --destdir  /home/python3 zlib-devel bzip2-devel openssl-devel ncurses-devel  epel-release gcc gcc-c++ xz-devel readline-devel gdbm-devel

 下载安装包:(也下载到/home/python3/)

wget --no-check-certificate  https://www.python.org/ftp/python/3.9.5/Python-3.9.5.tgz

2、离线环境安装

上传联网环境下载的东西上传到离线环境

安装依赖

cd /home/python3
rpm -Uvh ./*.rpm --nodeps --force

安装python3

tar -zxvf  Python-3*  #解压安装包
mkdir /usr/local/python3  # 创建编译安装目录
cd Python-3.9.5    # 进入python的解压目录
./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

这篇关于CENTOS离线环境安装python3.9.5的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!