当我尝试 python3 版本时,它不能作为命令使用

Lea*_*ner 0 python python-3.x docker

我有以下泊坞窗文件:

FROM ubuntu:latest

RUN apt-get update \
  && apt-get install -y python3-pip python3-dev \
  && cd /usr/local/bin \
  && ln -s /usr/bin/python3 python3 \
  && pip3 install --upgrade pip
USER root
COPY scripts scripts
RUN ls
RUN pwd
RUN chmod +x ./scripts/functional_test_cli/baft.py
COPY tests tests
RUN pip3 install Pytest
RUN pip3 install pytest-json-report
RUN pip3 install Tavern
RUN pip3 install allure-pytest
RUN pip3 install pytest-pythonpath
RUN pip install --upgrade setuptools
RUN which python

RUN python3 version
CMD ["python3", "./scripts/functional_test_cli/baft.py"]
Run Code Online (Sandbox Code Playgroud)

因此,当涉及到这一行 RUN python3 version 时,它会抛出以下错误:

python: can't open file 'version': [Errno 2] No such file or directory
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?为什么 python3 不被识别为命令?

occ*_*ere 5

改为python3 --version或怎么样?python3 -V

$ python3 --version
Python 3.7.3

$ python3 -V
Python 3.7.3
Run Code Online (Sandbox Code Playgroud)


我认为 python 上没有命令version。

(它可能看起来像文件参考。感谢@cricket_007)

$ python3 version
python3: can't open file 'version': [Errno 2] No such file or directory
Run Code Online (Sandbox Code Playgroud)