Problems with installing Python3 and Pip in ubuntu in Docker

  • 2021-10-13 09:03:01
  • OfStack

Text

1) Download the ubuntu image


docker pull ubuntu

2) View the image


docker images

3) Run the container


docker run -itd --name ubuntu-test ubuntu

4) Enter container


sudo docker exec -it ubuntu-test /bin/bash

5) Update the source


apt-get update

If this step is not carried out, such problems may arise:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package Python

Run it once

6) Install python3


apt-get install python3

7) Install pip3


 apt-get install python3-pip

8) Testing


pip3 install numpy
Collecting numpy
 Downloading numpy-1.20.1-cp38-cp38-manylinux2010_x86_64.whl (15.4 MB)
   | In fact, in fact, the | 15.4 MB 1.9 MB/s
Installing collected packages: numpy
Successfully installed numpy-1.20.1

Related articles: