cant install pip in ubuntu 18.04 docker /bin/sh: 1: pip: not found

巧了我就是萌 提交于 2021-02-07 20:18:47

问题


I am getting the error using pip in my docker image.

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

I installed python 3.6 and pip3 but getting

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

回答1:


To run pip for python3 use pip3, not pip.




回答2:


Another solution.

You can add this line (after apt-get install). It will upgrade pip to the version you need, for instance:

RUN pip3 install --upgrade pip==20.0.1

and you can then use pip install from requirements file (for instance):

RUN pip install -r requirements.txt


来源:https://stackoverflow.com/questions/60435261/cant-install-pip-in-ubuntu-18-04-docker-bin-sh-1-pip-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!