编程语言
首页 > 编程语言> > 编译安装python3.8共存自带python2.7

编译安装python3.8共存自带python2.7

作者:互联网

从官网下载最新python3.8

解压至本地文件夹

进入文件夹

为了避免出现问题,我们先提前安装第三方库

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

特别是libreadline不安装的话会出现上下左右和退格键无法使用的情况

编译至/usrlocal/python3.8

./configure --prefix=/usr/local/python3.8
make
make install

软连接至/usr/bin/下

sudo ln -s /usr/local/python3.8/bin/python3.8 /usr/bin/python3.8

接下来shell输入python3.8进入python3.8解释器

$ python3.8
Python 3.8.0 (default, Oct 27 2019, 12:31:44) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

搞定`

标签:bin,libreadline,sudo,python2.7,dev,usr,自带,python3.8
来源: https://www.cnblogs.com/top66zhoulei/p/11747188.html