在docker镜像中安装python时遇到的问题

在docker镜像中安装python

遇到的问题

[[email protected] /]# python3
bash: python3: command not found

Could not find a version that satisfies the requirement python3.6 (from versions: )
No matching distribution found for python
3.6
You are using pip version 18.1, however version 19.3.1 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.

解决方法

[email protected]:~$ sudo docker run -it tensorflow421:latest /bin/bash
[[email protected] /]# pip install --upgrade pip
yum install software-properties-common
yum install -y python3
yum install -y wget vim
wget -o /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
python3 /tmp/get-pip.py
pip3 install --upgrade pip
python3 #启动python
pip3 install xxxxxxx(自己要安装的包和工具)

问题图片

在docker镜像中安装python时遇到的问题