title: Docker how to make python 3.8 as default
body: <p>I'm trying to update an existing Dockerfile to switch from <code>python3.5</code> to <code>python3.8</code>, previously it was creating a symlink for <code>python3.5</code> and <code>pip3</code> like this:</p>
  <pre><code>RUN ln -s /usr/bin/pip3 /usr/bin/pip
  RUN ln -s /usr/bin/python3 /usr/bin/python
  </code></pre>
  <p>I've updated the Dockerfile to install <code>python3.8</code> from <code>deadsnakes:ppa</code></p>
  <pre><code>apt-get install python3-pip python3.8-dev python3.8-distutils python3.8-venv
  </code></pre>
  <p>if I remove <code>python3-pip</code>, it complains about gcc</p>
  <blockquote>
  <p>C compiler or Python headers are not installed on this system. Try to run: sudo apt-get install gcc python3-dev</p>
  </blockquote>
  <p>with these installations in place I'm trying to update existing symlink creation something like this:</p>
  <pre><code>RUN ln -s /usr/bin/pip3 /usr/local/lib/python3.8/dist-packages/pip
  RUN ln -s /usr/bin/pip /usr/local/lib/python3.8/dist-packages/pip
  RUN ln -s /usr/bin/python3.8 /usr/bin/python3
  </code></pre>
  <p>it fails, saying</p>
  <blockquote>
  <p>ln: failed to create symbolic link '/usr/bin/python3': File exists</p>
  </blockquote>
  <p>which I assume fails because <code>python3</code> points to <code>python3.6</code>.
  if I try: <code>RUN ln -s /usr/bin/python3.8 /usr/bin/python</code> it doesn't complain about symlink and image gets build successfully, but fails while installing requirements later (we use Makefile targets to install dependencies inside the container using <code>pip</code> and <code>pip-sync</code>):</p>
  <blockquote>
  <p>ERROR: Cannot uninstall 'python-apt'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.</p>
  </blockquote>
  <p>which I assume because <code>python-apt</code> gets installed as part of the default <code>python3.6</code> installation and <code>python3.8</code> pip can't uninstall it.</p>
  <p>PS: my Dockerfile image is based on <strong>Ubunut 18.04</strong> which comes with <code>python3.6</code> as default.</p>
  <p>How can I properly switch Dockerfile / image from <code>python3.5</code> to <code>python3.8</code>? so I can later use <code>pip</code> directly and it points to <code>python3.8</code>'s <code>pip</code></p>