Ubuntu下安装Python 3.6

提示:这里Ubuntu 的版本是16.04

一、安装python-dev包

sudo apt-get install python-dev

二、安装或升级pip

1.安装pip:

sudo apt-get install python-pip

2.升级pip

sudo pip install --upgrade pip

三、正式开始安装Python3.6

(1)在安装Python之前,请使用以下命令来安装Python所需要的包

$ sudo apt-get install build-essential checkinstall

$ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

(2)下载Python 3.6.0

$ cd /usr/src

$ wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz

(3)解压并编译Python源代码

$ cd Python-3.6.0

$ sudo ./configure

$ sudo make altinstall

(4)检查版本

输入python3.6 就可以看到版本信息了

你可能感兴趣的:(Ubuntu下安装Python 3.6)