gpt4 book ai didi

c# - 如何在 alpine 3.8 中安装 pythonnet

转载 作者:太空宇宙 更新时间:2023-11-03 14:39:21 27 4
gpt4 key购买 nike

我需要在新的 alpine 3.8/python 3.7 容器中安装 pythonnet。我已经为 Ubuntu 完成了它(这里的巨大帮助是 pythonnet 的 dockerfile)。我不能在 alpine 中使用 apt-get,只能使用 apk 命令,它们看不到任何 mono-complete 或 nuget(我认为安装这些将使我能够正确安装 pythonnet,尤其是 mono-complete 4.8.0.520-0xamarin3 版本)。我该怎么做?

最佳答案

Dockerfile:Stretch、Python 3.7.4、Mono 5.20.1、Pythonnet 2.4.0

# Pythonnet - Dockerfile
# ----------------------------------------------
# * based on debian stretch with python 3.7.4
# * mono 5.20.1 + pythonnet 2.4.0
# ----------------------------------------------
FROM python:3.7.4-stretch

# [ Mono: 5.20.1 ]
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \
&& echo "deb http://download.mono-project.com/repo/debian stretch/snapshots/5.20.1/. main" > /etc/apt/sources.list.d/mono-official.list \
&& apt-get update \
&& apt-get install -y clang \
&& apt-get install -y mono-complete=5.20.1\* \
&& rm -rf /var/lib/apt/lists/* /tmp/*

# [ pythonnet 2.4.0 ]
RUN pip install pycparser \
&& git clone https://github.com/pythonnet/pythonnet \
&& python pythonnet/setup.py bdist_wheel \
&& pip install --no-index --find-links=./pythonnet/dist/ pythonnet

关于c# - 如何在 alpine 3.8 中安装 pythonnet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58080541/

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