Can I install python 3.7 in ubuntu 18.04 without having python 3.6 in the system? : <p>Please read the question carefully before closing as duplicate, I believe the use case to be unique.</p>

<p>I'm trying to create a docker image that <strong>only has python 3.7 installed</strong>, the problem is that if I try to install pip, the command also installs python 3.6 which <strong>I do not want</strong>.</p>

<p>The relevant part of the ideal docker file I'm tinkering is as follows</p>

<pre><code>FROM ubuntu:18.04

# Upgrade installed packages
RUN apt-get update &amp;&amp; apt-get upgrade -y &amp;&amp; apt-get clean

# (...)

# Python package management and basic dependencies
RUN apt-get install -y python3.7 python3.7-dev python3.7-pip

# Register the version in alternatives
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1

# Set python 3 as the default python
RUN update-alternatives --set python /usr/bin/python3.7

# Upgrade pip to latest version
RUN python -m ensurepip --upgrade

# (...)

</code></pre>

<p>This would fail as <em>python3.7-pip</em> doesn't seem to exist; only <em>python3-pip</em> does, which is what installs python 3.6 for some reason.</p>

<p>I tried not installing pip at all and doing it manually, like so</p>

<pre><code># (...)

RUN apt-get install -y python3.7 python3.7-dev

# (...)

RUN curl 'https://bootstrap.pypa.io/get-pip.py' &gt; get-pip.py

RUN python get-pip.py pip --no-setuptools --no-wheel
</code></pre>

<p>Which fails with this error:</p>

<pre><code>Traceback (most recent call last):
  File "get-pip.py", line 21492, in &lt;module&gt;
    main()
  File "get-pip.py", line 197, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    import pip._internal
  File "/tmp/tmpbez2vju9/pip.zip/pip/_internal/__init__.py", line 40, in &lt;module&gt;
  File "/tmp/tmpbez2vju9/pip.zip/pip/_internal/cli/autocompletion.py", line 8, in &lt;module&gt;
  File "/tmp/tmpbez2vju9/pip.zip/pip/_internal/cli/main_parser.py", line 8, in &lt;module&gt;
  File "/tmp/tmpbez2vju9/pip.zip/pip/_internal/cli/cmdoptions.py", line 14, in &lt;module&gt;
ModuleNotFoundError: No module named 'distutils.util'
</code></pre>

<p>Again, installing python3-distutils results in python 3.6 appearing in the system</p>

<p>So, is there a way to install ONLY a fully functional python 3.7 in ubuntu 18.04, WITHOUT having to install python 3.6?</p>
