# docker run
docker run -it --rm amazonlinux:2 bash
コンテナ内で、
yum update -y
# install
amazon-linux-extras install python3.8 -y
# install devel
# `amazon-linux-extras install python3.8` の後じゃないと no package と言われる
yum install -y python38-devel # /usr/include/python3.8
pip3.8 install --upgrade pip # `pip`, `pip3` が3.8を向くようになる
pip install setuptools --upgrade
# run
python3.8
# venv
cd /tmp
python3.8 -m venv venv
source venv/bin/activate
おまけ(MySQL対応、3.8以外)
# 3.8じゃない時用
yum install -y python-devel # /usr/include/python2.7
yum install -y python3-devel # /usr/include/python3.7m
# MySQL操作で必要になる時用
yum install -y gcc
yum install -y mysql-devel mysql-libs # /lib64/mysql/libmysqlclient.so.18 が入る