menu Chancel's blog
rss_feed
Chancel's blog
秋雨一何碧,山色倚晴空。

Linux编译安装Python

类型:Linux
创建时间:2021-06-15 17:04:10
更新时间:2022-04-01 15:55:02
类型:Linux
更新时间:2022-04-01 15:55:02

首先准备安装环境,需安装以下编译工具 Ubuntu1804

sudo apt install libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev zlib1g-dev make gcc

Cent7 OS

sudo yum -y install wget xz tar gcc make tk-devel    sqlite-devel zlib-devel readline-devel openssl-devel curl-devel tk-devel gdbm-devel  xz-devel  bzip2-devel

在Python官网选择合适的安装包,我这里选择的是Python3.7版本(下载地址)

https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz

下载并解压

mkdir /tmp/python3 && cd /tmp/python3
wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
tar -zxvf Python-3.7.1.tar.gz && cd Python-3.7.1

选择安装目录并编译,我这里选择安装在 /usr/local/python3.7

./configure --prefix=/usr/local/python3.7
sudo make
sudo make install

最后,如有需要请添加到系统环境中(Path)中

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

[[replyMessage== null?"发表评论":"@" + replyMessage.m_author]]

account_circle
email
web_asset
textsms

评论列表([[messageResponse.total]])

[[messageItem.m_author]] [[messageItem.m_author]]
[[messageItem.create_time]]
[[getEnviron(messageItem.m_environ)]]
[[subMessage.m_author]] [[subMessage.m_author]] @ [[subMessage.parent_message.m_author]] [[subMessage.parent_message.m_author]]
[[subMessage.create_time]]
[[getEnviron(messageItem.m_environ)]]