0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

CentOS/Amazon Linux2に最新のpython3.xを導入する

Posted at

事前準備

sudo yum -y update
sudo yum groupinstall "Development Tools" -y 
sudo yum install openssl-devel libffi-devel bzip2-devel -y

変数PYTHONMAJORNUMにPythonのメジャー番号を指定する。
いまなら3.9とか3.10など

PYTHONMAJORNUM=3.9 
REVISIONNUM=`curl -s https://www.python.org/ftp/python/ |grep ${PYTHONMAJORNUM} |sed "s/.*href=\"${PYTHONMAJORNUM}.//g" |sed "s/\/\".*//g" |sort -n |tail -1` 
cd /tmp
rm -fr Python-${PYTHONMAJORNUM}.*  
wget https://www.python.org/ftp/python/${PYTHONMAJORNUM}.${REVISIONNUM}/Python-${PYTHONMAJORNUM}.${REVISIONNUM}.tgz  
tar xvf Python-${PYTHONMAJORNUM}.*.tgz  
cd Python-${PYTHONMAJORNUM}.*  
sudo ./configure --enable-optimizations  
sudo make altinstall
cd /tmp
rm -fr Python-${PYTHONMAJORNUM}.*
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?