ubuntu 更改python預設版本以及pip的python版本 - jenhaoyang/backend_blog GitHub Wiki

安裝python後下指令

FROM nvidia/cuda:10.2-devel-ubuntu18.04
RUN apt update
RUN apt install -y python3.8
RUN apt install -y build-essential python3.8-dev python3-pip
RUN ln -s /usr/bin/python3.8 /usr/bin/python
RUN apt install -y curl
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
RUN python3.8 get-pip.py

參考:
https://stackoverflow.com/questions/61717006/pip-for-python-3-8
https://stackoverflow.com/a/63937181