在Docker中的ubuntu中安裝Python3和Pip的問題
1)下載ubuntu鏡像
docker pull ubuntu
2)查看鏡像
docker images
3)運行容器
docker run -itd --name ubuntu-test ubuntu
4)進入容器
sudo docker exec -it ubuntu-test /bin/bash
5)更新源
apt-get update
如果不進行這一步的話,有可能會出現這樣的問題:
Reading package lists... DoneBuilding dependency treeReading state information... DoneE: Unable to locate package Python
運行一次即可6)安裝python3
apt-get install python3
7)安裝pip3
apt-get install python3-pip
8)測試
pip3 install numpyCollecting numpy Downloading numpy-1.20.1-cp38-cp38-manylinux2010_x86_64.whl (15.4 MB) |????????????????????????????????| 15.4 MB 1.9 MB/sInstalling collected packages: numpySuccessfully installed numpy-1.20.1
到此這篇關于在Docker中的ubuntu中安裝Python3和Pip的問題的文章就介紹到這了,更多相關Docker ubuntu安裝Python3和Pip內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!
相關文章: