我正在听https://realpython.com/intro-to-pyenv/
的指示我有一个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
图像构建良好,但是,当我运行它时,我看到使用的是Python 3.8.2:
python3 --version
返回:Python 3.8.2
。
python --version
返回:bash: python: command not found
我在做什么错?我想在映像中安装Python 3.7.8。