用Linux自带的下载工具wget下载(当前的最新版本python3.6.0),进入个人用户下面的Downloads下
cd ~/Downloads/
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
开始下载,下载完成后新建一个安装软件的目录:
mkdir /usr/local/python3.6.0
解压安装包:
tar -xvzf Python-3.6.0.tgz
配置安装路径:
./configure-prefix =/usr/local/python3.6.0/
make
make install
安装成功,把旧版本改名或删除:我这有两个旧的python
mv /usr/bin/python2 /usr/bin/python_old1
mv /usr/bin/python2.6 /usr/bin/python_old2
然后链接自己安装的python到默认路径:
ln -s /usr/local/python3.6.0/bin/python3.6 /usr/bin/python
检查python版本:
python -V