简体   繁体   English

在 Pipenv 上安装了 Alpine Docker 图像和 pandas

[英]Alpine Docker image with pandas installed on Pipenv

We need an alpine based docker image that can have pandas package within pipenv我们需要一个基于 docker 的图像,它可以在 pipenv 中包含 pandas package

This works.这行得通。

FROM python:3-alpine 
RUN apk add g++  && \ 
    pip install numpy

But, our process needs the install on pipenv and below fails with error pipenv not found但是,我们的过程需要在 pipenv 及以下安装失败,并出现错误 pipenv not found

FROM python:3-alpine
RUN apk add g++  && \ 
    pipenv install numpy

Note pipenv is installed in earlier docker statements.注意 pipenv 已安装在较早的 docker 语句中。 However, even the below fails, with pipenv not found然而,即使是下面的失败,也没有找到 pipenv

FROM python:3-alpine
RUN apk add g++  && \ 
    pip install --user pipenv && \
    pipenv install numpy

Any suggestions?有什么建议么?

pipenv isn't available because pip install --user pipenv installs it in /root/.local/bin , which isn't listed in the search path ( $PATH ). pipenv不可用,因为pip install --user pipenv将它安装在/root/.local/bin中,它未在搜索路径 ( $PATH ) 中列出。 The easiest way to fix it would be to install pipenv without the --user flag.修复它的最简单方法是安装不带--user标志的pipenv It will then be installed in /usr/local/bin/ :然后它将安装在/usr/local/bin/中:

FROM python:3-alpine
RUN apk add g++ && \
    pip install pipenv && \                                                     
    pipenv install numpy

If you run through the build steps manually, it gives you a warning about this:如果您手动运行构建步骤,它会向您发出警告:

  • docker run --rm -ti python:3-alpine /bin/sh
  • apk add g++
  • pip install --user pipenv this shows the warning below: pip install --user pipenv这显示以下警告:

WARNING: The scripts pipenv and pipenv-resolver are installed in '/root/.local/bin' which is not on PATH.警告:脚本 pipenv 和 pipenv-resolver 安装在不在 PATH 上的“/root/.local/bin”中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM