linux下安装python3
1,去官网获取相应的版本的地址:
https://www.python.org/downloads/
2,通过wget 获取:
wget https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tgz
3,解压:
tar -zxvf Python-3.8.6.tgz
4,安装操作系统相关依赖
yum install zlib zlib-devel openssl openssl-devel
yum install glib2-devel openssl-devel pcre-devel bzip2-devel gzip-devel
yum install libffi-devel -y
yum install libjpeg libjpeg-devel
yum install freetype freetype-devel
5,进入文件夹:
cd Python-3.8.6
,
然后检查 ,查看是否明显报错
sh configure
6,编译:
make
(看到Python build finished successfully!便可以执行下一步)
7,安装:
make install
9,执行
python3
便可以看到版本号,然后退出
quit()