1. apt安装python3.6

  1. ppa:jonathonf/python-3.6源已经被不能用了
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
  1. 在dockerfile中写入一下内容:
#安装python3.6 来自第三方
RUN apt-get update
RUN apt-get install -y python-software-properties
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update
RUN apt-get install -y python3.6
RUN apt install -y python3.6-dev
RUN apt install -y python3.6-venv curl

这个源,实测也可以:add-apt-repository ppa:fkrull/deadsnakes

2. 安装pip3

curl https://bootstrap.pypa.io/get-pip.py | python3.6

或者可以通过apt以以下步骤安装:

  • 先修改python3的软连接 /usr/bin/python3 -> /usr/bin/python3.6
  • 再通过apt安装python3-pip