简介
在CentOS6或者CentOS7上都是默认自带python2,而现在很多库都只支持Python3。
![b3ae8cb6b1863dc71c3d92feced2fc4c.png](https://img-blog.csdnimg.cn/img_convert/b3ae8cb6b1863dc71c3d92feced2fc4c.png)
安装命令
![8a80185ef6f53baf0026495342a996a4.png](https://img-blog.csdnimg.cn/img_convert/8a80185ef6f53baf0026495342a996a4.png)
复制命令一步步执行即可
yum -y install xz tar gcc make tk-devel wget sqlite-devel zlib-devel readline-devel openssl-devel curl-devel tk-devel gdbm-devel xz-devel bzip2-devel
cd /root/
wget -c https://www.python.org/ftp/python/3.6.10/Python-3.6.10.tar.xz
xz -d Python-3.6.10.tar.xz
tar xvf Python-3.6.10.tar
cd Python-3.6.10
./configure --prefix=/opt/python36
make
make install
echo 'export PATH=/opt/python36/bin:$PATH' >>/etc/profile
source /etc/profile
python3 -V
总结
快速安装
![a146c0c0a094341cab535066adcd7489.png](https://img-blog.csdnimg.cn/img_convert/a146c0c0a094341cab535066adcd7489.png)