Skip to content

Instantly share code, notes, and snippets.

@heiwa4126
Last active June 9, 2023 05:28
Show Gist options
  • Save heiwa4126/cf04ac83b77a3f535e5ecf788f86d9d0 to your computer and use it in GitHub Desktop.
Save heiwa4126/cf04ac83b77a3f535e5ecf788f86d9d0 to your computer and use it in GitHub Desktop.
AWS CloudShell(とAmazon Linuix 2)にPython 3.9をインストールする。 https://computingforgeeks.com/how-to-install-python-on-amazon-linux/ をアレンジ
sudo yum -y groupinstall "Development Tools"
sudo yum -y install openssl-devel bzip2-devel libffi-devel xz-devel jq
curl https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tar.xz -O
tar xf Python-3.9.9.tar.xz
cd Python-3.9.9
./configure --enable-optimizations
sudo make altinstall
cd ..
sudo rm -rf Python-3.9.9 Python-3.9.9.tar.xz
sudo /usr/local/bin/python3.9 -m pip install --upgrade pip
pip3.9 install -U -user yq
python3.9 --version
pip3.9 --version
# gccが古いと --enable-optimizations オプションをつけると `Could not import runpy module`で死ぬかもしれない
# readline-develがないと、>>>でヒストリ等が効かない。用途によってアレンジ
# 最新版は https://www.python.org/ftp/python/ から探して。
@heiwa4126
Copy link
Author

jqとyqはオマケ。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment