Linux CentOS 7.6安装python3.7以及pip19

文章目录

      • 一、环境准备
      • 二、安装python3.7
        • 2.1 安装依赖包
        • 2.2 安装Python3.7
        • 2.3 创建软连接
      • 三、验证版本

一、环境准备

参考博客:https://www.centos.bz/2018/05/centos-7-4-%E5%AE%89%E8%A3%85python3%E5%8F%8A%E8%99%9A%E6%8B%9F%E7%8E%AF%E5%A2%83/

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core)

二、安装python3.7

2.1 安装依赖包

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 libffi-devel

2.2 安装Python3.7

mkdir -p /usr/local/python3 \
&& yum install -y wget \
&& wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz \
&& tar -xvf Python-3.7.0.tar.xz \
&& cd Python-3.7.0 \
&& ./configure --prefix=/usr/local/python3/ \
&& make \
&& make install 

2.3 创建软连接

ln -s /usr/local/python3/bin/python3 /usr/bin/python3 && ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

三、验证版本

[root@localhost Python-3.7.0]# python3 --version
Python 3.7.0
[root@localhost Python-3.7.0]# pip3 --version
pip 10.0.1 from /usr/local/python3/lib/python3.7/site-packages/pip (python 3.7)

升级pip版本命令

pip3 install --upgrade pip

提示成功
Linux CentOS 7.6安装python3.7以及pip19_第1张图片
查看版本

[root@localhost Python-3.7.0]# pip3 --version
pip 19.1.1 from /usr/local/python3/lib/python3.7/site-packages/pip (python 3.7)

临时源(豆瓣)

pip install pythonModuleName -i https://pypi.douban.com/simple

你可能感兴趣的:(Linux运维)