Centos6.8安装python环境

2023-01-31 05:01:28 centos6 环境 安装

一.安装步骤
1.检查系统python
Centos 6.8自带的是Python 2.6.6,yum中最新的也是Python 2.6.6,只能下载Python 2.7.12的源代码自己编译安装。如下图:
Centos6.8安装python环境

  1. 安装Development tools
    #yum -y groupinstall "Development tools"
    Centos6.8安装python环境
  2. 安装编译Python需要的包
    #yum install zlib-devel -y
    Centos6.8安装python环境
    #yum install bzip2-devel -y
    Centos6.8安装python环境
    #yum install openssl-devel -y
    Centos6.8安装python环境
    #yum install ncurses-devel -y
    Centos6.8安装python环境
    #yum install sqlite-devel -y
    Centos6.8安装python环境
    #yum install tcl-devel –y

#yum install tk-devel -y
4.下载并解压Python 2.7.12的源代码
#cd /opt
#wget --no-check-certificate https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz
#tar xf Python-2.7.12.tar.xz
#cd Python-2.7.12
Centos6.8安装python环境
#tar xf Python-2.7.12.tar.xz
#cd Python-2.7.12
Centos6.8安装python环境

  1. 编译与安装Python 2.7.12
    #./configure --prefix=/usr/local
    #make && make install
    6.将python命令指向Python 2.7.12

#rm –rf python

#ln -s /usr/local/bin/python2.7 /usr/bin/python

#python –version
Centos6.8安装python环境
由上图所示 python2.7安装完成

如果对此有兴趣,请扫下面二维码免费获取更多详情

Centos6.8安装python环境

相关文章