1、网上尝试了诸如以下的安装办法,不成功…(不建议采用)
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
2、尝试下载源文件直接安装,可以成功,操作如下:
wget http://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
tar -xvzf Python-3.6.4.tgz
cd Python-3.6.4
./configure --with-ssl
make
sudo make install
安装好之后输入python3
,输出如下,说明安装成功
Python 3.6.4 (default, Dec 16 2019, 11:03:42)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
修改系统文件,把python3作为默认的Python,操作如下:
alias python=python3
在.bashrc中添加如下代码便可以使用python3.6:
#export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.6/site-packages
完成!