5
1

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 3 years have passed since last update.

AmazonLinux2のDockerコンテナにPython3を入れる

Last updated at Posted at 2020-09-15
# 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 が入る
5
1
2

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
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?