CentOS 7.* 安装 python3.8.2 步骤

CentOS 7系列 安装 python3.8.2 步骤

1、在python官网下载linux源码包

地址:https://www.python.org/ftp/python/3.8.3/Python-3.8.3rc1.tgz 

2、将文件放在 /tmp/文件夹下

cd /tmp

wget https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tgz

3、解压缩和安装python3.*

将安装包解压到 /tmp

tar xvf 解压缩 -C 指定目录

  tar xvf Python-3.8.1.tgz -C /tmp/

解压后会生成 Python-3.8.1 目录,进入目录开始安装

       进入目录

  cd /tmp/Python-3.8.1

       安装

  ./configure --prefix=/usr/local/python3

        make && make install

        

 页面提示

Successfully installed pip-19.2.3 setuptools-41.2.0 安装成功

4、配置环境变量并生效

vim  /etc/profile

点击键盘“o”键在文档最后新增如下代码

  #python3.8  configuration
  PATH=$PATH:/usr/local/python3/bin:
  export PATH

保存并退出vim

 点击键盘ESC,输入:wq回车

使配置生效

source /etc/profile

5、验证python3安装是否生效

 如上图已生效,

查看本机自带python2是否可用

自带python已生效 。

注:如果不想用自带的2.7.5 可以进行升级。只需在/etc/profile文件中 新增python2*的路径即可

PATH=$PATH:/usr/local/python3/bin:/usr/local/python2.7.15/bin

猜你喜欢

转载自www.cnblogs.com/activiti/p/12810781.html