-
-
Save john-science/d43102fd64d7bbd406e0f03fb7441bca to your computer and use it in GitHub Desktop.
FROM ubuntu:20.04 | |
RUN apt-get update && \ | |
apt-get install --no-install-recommends -y python3-pip python3.8-dev && \ | |
apt-get install vim && \ | |
apt-get install git |
In this way, you install python3.8 and python 3.6. And the default python3 is python3.6 instead of python3.8.
In this way, you install python3.8 and python 3.6. And the default python3 is python3.6 instead of python3.8.
Are you sure? Because I am explicitly calling out "python3.8" by name.
In this way, you install python3.8 and python 3.6. And the default python3 is python3.6 instead of python3.8.
Are you sure? Because I am explicitly calling out "python3.8" by name.
Hi, Yes. I just have a try. When I call python3, I get python 3.6.9. This is because that python3-pip would introduce python3.6.
I can confirm this, but I'm not sure there's a good way around this. There's no python3.8-pip package in the Ubuntu repos, and for good reason. python3.6 is the default version of python3 for Ubuntu 18.04.
I guess one could use
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3.8 get-pip.py
instead?
In theory it would be possible to then use update-alternatives
, but that's probably risky.
@iFreilicht and @nanguoyu Okay, this is pretty annoying. How would you guys feel about moving this Dockerfile to Ubuntu 20.04? I just checked and it looks like Python 3.8 is the default install there.
It would solve the issue of Python versions, and I personally want the newer version of Ubuntu. But if you guys want 18.04, I can maybe use the above curl
hack.
Yes, you can move to Ubuntu 20.04. If Ubuntu 18.04 and Python 3.8 are essential to you, you can install Python from source and then use update-alternatives
.
See this: https://gist.github.com/nanguoyu/0f67ce488da4b3ca179d3af0c8cdc699
Miniconda maybe also a choice.
RUN wget \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& mkdir /root/.conda \
&& bash Miniconda3-latest-Linux-x86_64.sh -b \
&& rm -f Miniconda3-latest-Linux-x86_64.sh
RUN pip3 install --upgrade pip &&\
pip3 install setuptools>=41.0.0
@theJollySin I'm not using this dockerfile anyway, so I'm fine with you upgrading it :)
Thanks for that!