Linux离线安装Python3.6.8⼀、环境
1,系统:CentOS 7
2,⽤户:root
3,Python版本:python3.6.8
⼆、安装
1,登录到centOS机器,新建⽂件夹
mkdir /usr/local/python3
2,将安装包和依赖包⾥的⽂件上传⾄/usr/local/python3
python默认安装路径
3,进⼊⽬录
cd /usr/local/python3/
4,安装依赖
#安装依赖包 zlib-devel
rpm -ivh zlib-devel-1.2.7-17.el7.x86_64.rpm
#安装依赖包 bzip2-devel
rpm -ivh bzip2-devel-1.0.6-13.el7.x86_64.rpm
#安装依赖包 epel-release
rpm -arch.rpm
#安装依赖包 ncurses-devel
rpm -ivh ncurses-devel-5.9-13.20130511.el7.x86_64.rpm
# 安装依赖包 gcc(⼀定要按照以下的顺序进⾏安装)
rpm -ivh mpfr-3.1.1-4.el7.x86_64.rpm
rpm -ivh libmpc-1.0.1-3.el7.x86_64.rpm
rpm -ivh kernel-headers-3.10.0-514.el7.x86_64.rpm
rpm -ivh glibc-headers-2.17-157.el7.x86_64.rpm
rpm -ivh glibc-devel-2.17-157.el7.x86_64.rpm
rpm -ivh cpp-4.8.5-11.el7.x86_64.rpm
rpm -ivh gcc-4.8.5-11.el7.x86_64.rpm
# 安装依赖包 gcc-c+
rpm -ivh libstdc++-4.8.5-11.el7.x86_64.rpm
rpm -ivh libstdc++-devel-4.8.5-11.el7.x86_64.rpm
rpm -ivh gcc-c++-4.8.5-11.el7.x86_64.rpm
5,进⾏解压
tar -xzvf Python-3.
6,进⼊解压路径
cd /usr/local/python3/Python-3.6.8
7,设置安装路径
./configure --prefix=/usr/local/python3.6 --enable-shared make
make install
ln -s /usr/local/python3.6/bin/python3 /usr/bin/python3
echo "/usr/local/python3.6/lib" > /etc/f.d/f ldconfig
8,检查Python3.6.8是否安装成功
python3 -V
显⽰如下图,说明成功;
9,删除安装包以及依赖包
rm -rf  /usr/local/python3
三、安装pip3
1,python 3.6.8中⾃带了pip,所以只需要建⽴链接就⾏
ln -s /usr/local/python3.6/bin/pip3.6 /usr/bin/pip3
2,检查pip是否安装成功
pip3 -V
出现如下图,表⽰正常:

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。