RedHat安装Python3.6版本

说明:python3.6后安装时自行安装pip,setuptools

1. 升级的环境信息
1.1 操作系统: 
[root@mongodba bin]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.0 (Santiago)


1.2 Python版本:
[root@storage ~]# python -V
Python 2.6.6


2. 下面我们将从Python源码进行编译并安装Python3.6版本(保留老的Python版本,尽量不要动老版本的东西)
2.1 下载Python(可以登录Python官网下载后上传到Linux操作系统中,也可以通过在Linux中通过wget命令下载)
wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz


2.2 解压缩Python-3.6.6.tgz安装包
tar -zxvf Python-3.6.6.tgz


2.3 进入解压后的目录并进行编译安装
cd Python-3.6.6
mkdir /usr/local/python3.6
./configure --prefix=/usr/local/python3.6
make
make install



#重新建立Python3.4的环境变量
ln -s /usr/local/python3.6/bin/python3.6  /usr/bin/python3


2.4 查询Python版本信息
[root@mongodba Python-3.6.6]# python -V
Python 3.6.6

安装python的时候出现如下的错误:

[root@master ~]#./configure --prefix=/usr/local/python3.6

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu
checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... linux
checking for --without-gcc... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/src/pythonSoft/Python-3.3.4':
configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details

由于本机缺少gcc编译环境

1、通过yum安装gcc编译环境:yum install -y gcc

2、本机没有安装yum功能,可下载gcc安装包:https://gcc.gnu.org/

猜你喜欢

转载自blog.csdn.net/weixin_40283570/article/details/81630111