BlueCurve
BlueCurve

Reputation: 33

How to upgrade to Python 3.5 in a Docker container that has already installed Python 3.4? (I'm running Docker containers on Ubuntu 20.04)

I am using Docker on Ubuntu 20.04. A Docker container has already Python 3.4.2 installed on it. Now, I'm gonna upgrade it to Python 3.5 or later. I didn't find anything useful on the web to do that. Would be thankful if anyone lends my hands.

I need that to install numpy on the Docker container. I've already upgraded the pip and setuptools for the Python 3.4.2, but when I run:

pip3 install numpy

it returns that a Python 3.5 or later required.

Any help would be appreciated!

Upvotes: 2

Views: 11016

Answers (2)

ashnair1
ashnair1

Reputation: 365

As @Raedwald mentioned, you can use your ucmercedandeslab/tinyos_debian image as the base image and create a new docker image with specified version of python installed. To do this you need to do the following:

Step 1: Create a Dockerfile. You can use the file specified here. This Dockerfile uses the pyenv library to manage python versions. All you need to do is change the first line from

FROM debian:stable to FROM ucmercedandeslab/tinyos_debian:latest

Change the python arg (ARG PYTHON_VERSION=3.6.2) to whatever version you prefer. By default it's Python 3.6.2

Step 2: Build docker image via the docker build command

You now have a docker image that has python 3.6.2 as the default python.

Upvotes: 2

Raedwald
Raedwald

Reputation: 48682

Change the base image in the Dockerfile, tto use the new Python version, then rebuild the image.

Upvotes: 1

Related Questions