【问题标题】:No module named PyInstaller' after what appears to be a successful install似乎成功安装后没有名为 PyInstaller 的模块
【发布时间】:2022-07-19 14:21:02
【问题描述】:

我正在构建一个 docker 映像。在其中,我试图在一个RUN 中安装许多 python 包。该命令中的所有软件包都已正确安装,但 PyInstaller 不是出于某种原因,尽管构建日志让我认为它应该是:Successfully installed PyInstaller

重现问题的最小 Dockerfile:

FROM debian:buster

RUN apt-get update && \
    apt-get install -y \
    python3 \
    python3-pip \
    unixodbc-dev 


RUN python3 -m pip install --no-cache-dir pyodbc==4.0.30 && \
    python3 -m pip install --no-cache-dir Cython==0.29.19 && \
    python3 -m pip install --no-cache-dir PyInstaller==3.5 && \
    python3 -m pip install --no-cache-dir selenium==3.141.0 && \
    python3 -m pip install --no-cache-dir bs4==0.0.1 

RUN python3 -m PyInstaller

最后一个运行命令失败并显示/usr/bin/python3: No module named PyInstaller,所有其他包都可以按预期导入。

这个问题也可以通过这个 Dockerfile 重现:

FROM debian:buster

RUN apt-get update && \
    apt-get install -y \
    python3 \
    python3-pip

RUN python3 -m pip install --no-cache-dir PyInstaller==3.5 
RUN python3.7 -m PyInstaller 

这个问题的原因是什么?解决方法是什么?

【问题讨论】:

    标签: python docker pip pyinstaller


    【解决方案1】:

    我不熟悉PyInstaller,但他们在requirements 页面上写道:

    如果 pip 设置无法构建引导加载程序,或者如果您不使用 pip 要安装,您必须手动编译引导加载程序。过程是 在构建引导加载程序中进行了描述。

    你在Dockerfile中尝试过吗?

    (你完全正确,它应该失败......)

    【讨论】:

      猜你喜欢
      • 2017-09-05
      • 2019-05-05
      • 1970-01-01
      • 2019-03-30
      • 1970-01-01
      • 2017-11-28
      • 1970-01-01
      • 2019-07-02
      • 1970-01-01
      相关资源
      最近更新 更多