Python3安装(编译安装)
1. 从官网下载压缩的源码
https://www.python.org/ftp/python/3.6.10/Python-3.6.10.tgz
wget https://mirrors.huaweicloud.com/python/3.6.5/Python-3.6.5.tgz
2. 解压
tar -zxvf Python-3.6.10.tgztar -zxvf Python-3.6.10.tgztar -zxvf Python-3.6.10.tgz
3. 编译安装
先安装依赖包
494 yum -y install zlib-devel
494 yum -y install bzip2-devel
495 yum -y install openssl-devel
496 yum -y install ncurs
497 yum -y install ncurs Loaded plugins: fastestmirror
498 yum -y install ncurses-devel
499 yum -y install sqlite-devel
500 yum -y install readline-devel
501 yum -y install tk-devel
502 yum -y install db3-devel
503 yum -y install db4-devel
504 yum -y install libpcap-devel
505 yum -y install xz-devel
4. 编译和安装
[root@spark:Python-3.6.10]$ ./configure --prefix=/home/hadoop/app/python3
creating Makefile
If you want a release build with all stable optimizations active (PGO, etc),
please run ./configure --enable-optimizations
5. 安装
make && make install
需要5分钟左右的时间,
有如下提示:
Looking in links: /tmp/tmpbtjadby7
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-18.1 setuptools-40.6.2
6. 配置环境变量
[root@spark:bin]$ pwd
/home/hadoop/app/python3/bin
vi ~/.bash_profile
添加:
export PATH=/home/hadoop/app/python3/bin:$PATH
source ~/.bash_profile