ubuntu 20.04 安装python 3.6.8

ubuntu 20.04 源码安装python 3.6.8

在这里插入图片描述
在这里插入图片描述

安装依赖工具

sudo apt-get install -y gcc make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev

下载源码文件压缩包

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

解压源码文件压缩包

tar -xzf Python-3.6.8.tgz

配置

cd Python-3.6.8
sudo ./configure --enable-optimizations --prefix=/usr/local/bin/python3.6
  • –prefix=/usr/local/bin/python3.6:编译的时候用来指定程序存放路径。

编译

sudo make

安装

sudo make install

设置软链接

sudo ln -s -f /usr/local/bin/python3.6/bin/python3.6 /usr/bin/python3.6
sudo ln -s -f /usr/local/bin/python3.6/bin/pip3.6 /usr/bin/pip3.6

你可能感兴趣的:(Python,#,Ubuntu,python,ubuntu)