Running python code in docker : "ImportError: No module named tqdm"
Running python code in docker : "ImportError: No module named tqdm"
我看过很多关于 python 的 ImportError 的帖子,但到目前为止还没有解决方案。
我有一个短代码 test.py 使用 tqdm 包在终端中显示进度条。此脚本 运行 在 ubuntu 终端中运行良好,但在 docker 容器内 运行 时引发“"ImportError: No module named tqdm"”。
(容器允许我使用 openface 算法 运行 宁另一个 python 只要不包括 tqdm 就可以正常工作的代码)
这是构建 docker 容器的 Dockerfile :
FROM bamos/openface
RUN pip install tqdm
RUN apt-get update
在 Linux Ubuntu
感谢您的帮助!
编辑:使用以下 docker 文件
解决了问题
FROM bamos/openface
RUN ln -s /root/openface/models/ /models
RUN apt-get update && apt install python-pip
RUN pip install -U pip && pip install tqdm
谢谢大家!
尝试指定您要使用的 python 版本。
例如,python3.7 -m pip install tqdm
.
请注意,您应该在该映像中安装 python 和 python-pip。
我看过很多关于 python 的 ImportError 的帖子,但到目前为止还没有解决方案。
我有一个短代码 test.py 使用 tqdm 包在终端中显示进度条。此脚本 运行 在 ubuntu 终端中运行良好,但在 docker 容器内 运行 时引发“"ImportError: No module named tqdm"”。 (容器允许我使用 openface 算法 运行 宁另一个 python 只要不包括 tqdm 就可以正常工作的代码)
这是构建 docker 容器的 Dockerfile :
FROM bamos/openface
RUN pip install tqdm
RUN apt-get update
在 Linux Ubuntu
感谢您的帮助!
编辑:使用以下 docker 文件
解决了问题FROM bamos/openface
RUN ln -s /root/openface/models/ /models
RUN apt-get update && apt install python-pip
RUN pip install -U pip && pip install tqdm
谢谢大家!
尝试指定您要使用的 python 版本。
例如,python3.7 -m pip install tqdm
.
请注意,您应该在该映像中安装 python 和 python-pip。