Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.6k views
in Technique[技术] by (71.8m points)

Creating a docker container that runs Ubuntu with Python 3.6+ and Pip

I'm trying to install Python 3.6 or above with pip in an docker container that runs Ubuntu. I've tried quite a few things with no success

FROM ubuntu:18.04
RUN apt update
RUN apt install software-properties-common -y
RUN add-apt-repository ppa:deadsnakes/ppa
RUN ln -s /usr/bin/pip3 /usr/bin/pip
RUN ln -s /usr/bin/python3.8 /usr/bin/python
RUN apt install python3.8 -y
RUN apt install pip

RUN pip install auto-sklearn
RUN pip install pandas

ADD test.py /

CMD [ "python", "./test.py" ]

This returns "Unable to locate package pip." I tried removing "apt install pip" incase Python 3.8 comes with it, but it gives me the error: "pip: not found."

FROM ubuntu:18.04
RUN apt install software-properties-common -y
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update
RUN install python3-pip
RUN pip install auto-sklearn
RUN pip install pandas

ADD test.py /

CMD [ "python", "./test.py" ]

This installs pip, but auto-sklearn requires Python version 3.6 or higher and this installs a lower version. Auto-sklearn requires Linux as well which is why I'm using "FROM ubuntu" rather than "FROM python" cause "FROM python" seems to build a container on whatever native OS is running on the computer building the container, which for me is Windows.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...