gpt4 book ai didi

python - 尝试使用MSBuild工具,Python,pip和Python依赖关系创建docker容器

转载 作者:行者123 更新时间:2023-12-02 19:51:02 25 4
gpt4 key购买 nike

这是我最近的尝试,但未成功。我有要尝试容器化的python脚本。问题在于该脚本使用了库Office365,该库需要使用MS Build Tools。因此,我一直在努力寻找如何创建具有“pip”功能的MSBuild工具/ Python容器的方法。有任何想法吗?!

FROM python:3.8.0-windowsservercore

ADD https://aka.ms/vs/15/release/vs_buildtools.exe C:\\Downloads\\vs_buildtools.exe ADD https://dist.nuget.org/win-x86-commandline/v4.3.0/nuget.exe C:\\Nuget\\nuget.exe

RUN C:\\Downloads\\vs_buildtools.exe --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Workload.NetCoreBuildTools --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.WebBuildTools --quiet --wait RUN SETX /M Path "%Path%;C:\\Nuget;C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin"

# Install Dependencies
RUN pip install pandas
RUN pip install datetime
RUN pip install tqdm
RUN pip install office365

# Add Script ADD AutoDemandLeadtime.py /

# Run CMD [ "python", "./AutoDemandLeadtime.py" ]

最佳答案

这实际上对我有用!!!

# escape=`

FROM mcr.microsoft.com/dotnet/framework/sdk:4.8

SHELL ["cmd", "/S", "/C"]

ADD https://aka.ms/vs/16/release/vs_buildtools.exe C:\Temp\vs_buildtools.exe
ADD https://aka.ms/vs/16/release/channel C:\Temp\VisualStudio.chman
RUN C:\Temp\vs_buildtools.exe `
--quiet --wait --norestart --nocache `
--installPath C:\BuildTools `
--channelUri C:\Temp\VisualStudio.chman `
--installChannelUri C:\Temp\VisualStudio.chman `
--add Microsoft.VisualStudio.Workload.VCTools;includeRecommended `
--add Microsoft.Component.MSBuild `
|| IF "%ERRORLEVEL%"=="3010" EXIT 0

RUN powershell.exe -ExecutionPolicy RemoteSigned `
iex (new-object net.webclient).downloadstring('https://get.scoop.sh'); `
scoop install python git

# Install Dependencies
RUN pip install pandas
RUN pip install datetime
RUN pip install tqdm
RUN pip install office365

# Add Script
ADD AutoDemandLeadtime.py /

ENTRYPOINT C:\BuildTools\Common7\Tools\VsDevCmd.bat &&
CMD [ "python", "./AutoDemandLeadtime.py" ]

关于python - 尝试使用MSBuild工具,Python,pip和Python依赖关系创建docker容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60675598/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com