python - Windows Docker (Python) 中的 DLL 问题
问题描述
我在将代码加载到 Docker 容器中时遇到问题。
我的dockerfile如下:
FROM python:3
USER ContainerAdministrator
RUN curl -fSLo vc_redist.x64.exe https://aka.ms/vs/16/release/vc_redist.x64.exe `
&& start /w vc_redist.x64.exe /install /quiet /norestart `
&& del vc_redist.x64.exe
RUN setx path "%path%;C:\Windows\SysWOW64"
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH="$PYTHONPATH:/DeepLearningController"
COPY DeepLearningController /
COPY requirements.txt /
RUN pip install --upgrade pip
RUN pip --no-cache-dir install -r requirements.txt
RUN pip --no-cache-dir install tensorflow==2.2.0
CMD [ "python", "./DeepLearningController"]
当我运行此代码时,我遇到一个错误:
ImportError: Could not find the DLL(s) 'msvcp140.dll or msvcp140_1.dll'. TensorFlow requires that these DLLs be installed in a directory that is named in your %PATH% environment variable. You may install these DLLs by downloading "Microsoft C++ Redistributable for Visual Studio 2015, 2017 and 2019" for your platform from this URL: https://support.microsoft.com/help/2977003/the-latest-supported-visual-c-downloads
如果我在 Docker 上使用 Linux 容器,同样的效果也很好。我的主机操作系统是 windows。
我尝试在 dockerfile 中添加 python 路径,但我不确定为什么这不起作用。任何建议都会很棒!
谢谢!
解决方案
推荐阅读
- javascript - 代码片段管理器中的 JavaScript 片段未显示在 Intellisense 中
- javascript - 从父 div 中删除子 div
- c++ - CMake - 如何跨平台链接到 ExternalProject_Add 生成的库?
- c++ - 减少 C++ 中的嵌套循环
- python - 在 numpy 数组上“绘制”一个随机菱形(菱形)(测试哈里斯角检测)
- python - 无法在 MacBook 上的 PyCharm 中安装 Flask
- mysql - 在 MYSQL 中分组之前尝试 SUM() 列值
- python - Pygame背景未加载
- xcode - 如何将电容器白名单插件添加到离子应用程序
- php - 使用 CURLOPT_HTTPHEADER AccessKey 保护 php 页面