ubuntu18.04编译安装python3.8

  1. 下载
  2. 编译安装
  3. 运行测试

下载

# 下载源码包至`opt`目录
wget -c -P /opt https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz
# 解压解包
tar - xvf Python-3.8.0.tar.xz 
cd Python-3.8.0

编译安装

# 更新系统
apt-get update
apt-get upgrade
apt-get dist-upgrade
# 安装依赖库
apt-get install libbz2-dev libncurses5-dev libgdbm-dev libgdbm-compat-dev liblzma-dev libsqlite3-dev libssl-dev openssl tk-dev uuid-dev libreadline-dev  python-dev

./configure --enable-optimizations --enable-shared
make -j8
make altinstall

运行测试

python3.8
# python3.8: error while loading shared libraries: libpython3.8.so.1.0: cannot open shared object file: No such file or directory

配置动态链接库路径

vim ~/.profile
# 追加
export LD_LIBRARY_PATH="/usr/local/lib"
alias python="/usr/local/bin/python3.8"
alias python3.8="/usr/local/bin/python3.8"
# 更新
source ~/.profile

再次测试成功!


转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 [email protected]

文章标题:ubuntu18.04编译安装python3.8

文章字数:183

本文作者:Spaceack

发布时间:2019-11-18, 04:00:00

最后更新:2020-01-21, 03:13:31

原始链接:http://spaceack.com/2019/11/18/2019-11-18-ubuntu-install-python3.8/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。

目录