一、make install (失败的)
1、wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
2、tar -xzvf Python-3.7.0.tgz
3、cd ./Python-3.7.0
4、./configure
果然报错:make: *** No targets specified and no makefile found. Stop.
我也曾尝试解决这个问题,但是在公司时间也有限,就只能寻求他法了
5、make
6、make install
7、make clean
8、make distclean
9、mv /usr/bin/python /usr/bin/python3.7.0
10、ln -s /usr/local/bin/python3.7 /usr/bin/python
11、vi /usr/bin/yum
找到第一行#!/usr/bin/python 改为 #!/usr/bin/python3.7.0
二、PPA (成功的)
添加PPA
sudo add-apt-repository ppa:jonathonf/python-3.6
更新
sudo apt-get update
sudo apt-get install python3.6
可能会报错,按照提示解决就好
sudo dpkg --configure -a
更换python的默认版本
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
python -V