Python 无法在ubuntu 18.04 docker/bin/sh中安装pip:1:pip:未找到

Python 无法在ubuntu 18.04 docker/bin/sh中安装pip:1:pip:未找到,python,docker,pip,dockerfile,ubuntu-18.04,Python,Docker,Pip,Dockerfile,Ubuntu 18.04,我在docker映像中使用pip时出错 FROM ubuntu:18.04 RUN apt-get update && apt-get install -y \ software-properties-common RUN add-apt-repository universe RUN apt-get install -y \ python3.6 \ python3-pip ENV PYTHONUNBUFFERED 1 RUN mkdir /api W

我在docker映像中使用pip时出错

FROM ubuntu:18.04

RUN apt-get update && apt-get install -y \
    software-properties-common
RUN add-apt-repository universe
RUN apt-get install -y \
    python3.6 \
    python3-pip

ENV PYTHONUNBUFFERED 1
RUN mkdir /api
WORKDIR /api

COPY . /api/
RUN pip install pipenv
RUN ls
RUN pipenv sync
我安装了Python3.6和pip3,但是

Step 9/11 : RUN pip install pipenv
 ---> Running in b184de4eb28e
/bin/sh: 1: pip: not found

要为python3运行
pip
,请使用
pip3
,而不是
pip

另一种解决方案

您可以添加此行(在apt获得安装后)。它会将pip升级到您需要的版本,例如:

RUN pip3 install --upgrade pip==20.0.1
RUN pip install -r requirements.txt
然后,您可以使用需求文件中的
pip安装
(例如):


只是一个想法:您是否考虑过使用
python:3.6
而不是
ubuntu:18.04
?它已经有了
pip