1 python2.x安装
通过源代码安装,以2.7.13为例
1.1 下载源代码安装包
a.联网情况
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
b.未联网情况
去页面https://www.python.org/downloads/release/python-2713/下载Gzipped source tarball
到本地,如图
1.2 解压
tar -zxf Python-2.7.13.tgz
1.3 编译安装
cd Python-2.7.13
./configure --prefix=/usr/local/python-2.7.13
make
make install
1.4 设置软链
安装完可以直接执行python
/usr/local/python-2.7.13/bin/python
设置python的软链
ln -s /usr/local/python-2.7.13/bin/python /usr/bin/python2.7.13
参考文档:https://www.cnblogs.com/toulanboy/articles/7753502.html
官方安装文档:https://www.cnblogs.com/toulanboy/articles/7753502.html
2 python3.x安装
安装同python2.x一样,具体可以参考官网
https://docs.python.org/3/using/unix.html#on-linux
3 python卸载
由于上面是通过编译安装,卸载方法可以参考
https://www.zhihu.com/question/20092756