I'm following instruction from https://realpython.com/intro-to-pyenv/
I have a Dockerfile:
FROM ubuntu:20.04
# needed by many packages (like Ansible)
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
software-properties-common
# pyenv dependencies
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
# Install pyenv and Python 3.7
RUN curl https://pyenv.run | bash
ENV PATH=$HOME/.pyenv/bin:$PATH
RUN $HOME/.pyenv/bin/pyenv install -v 3.7.8
RUN eval "$(/root/.pyenv/bin/pyenv init -)" && eval "$(/root/.pyenv/bin/pyenv virtualenv-init -)"
RUN $HOME/.pyenv/bin/pyenv global 3.7.8
The image builds fine, however, when I run it, I see that Python 3.8.2 is used:
python3 --version
returns: Python 3.8.2
.
python --version
returns: bash: python: command not found
What am I doing wrong? I'd like to have Python 3.7.8 installed in my image.