一、CentOS安装Python3
centos7自带版本是python2.7
如果要用的3.0以上的版本需要手动安装,下载地址:https://www.python.org/ftp/python/
1、先查看系统python的位置在哪儿
whereis python
python2.7默认安装是在 /usr/bin目录中,切换到/usr/bin/
cd /usr/bin/
ll python*
从下面的图中我们可以看到,python指向的是python2,python2指向的是python2.7,因此我们可以装个python3,然后删除python链接,将python3指向python3,然后python2指向python2.7,那么两个版本的python就能共存了。
2、下载python3的包之前,要先安装相关的依赖包,用于下载编译python3:
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-dev