You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

macOS下使用.NET 7运行TensorFlow.NET时遇DllNotFoundException错误求助

macOS .NET 7环境下TensorFlow.NET加载库失败问题

我尝试在macOS系统的.NET 7环境中运行基础TensorFlow相关代码,以下是我的.proj文件内容:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="SciSharp.TensorFlow.Redist" Version="2.11.3" />
    <PackageReference Include="TensorFlow.Keras" Version="0.10.5" />
    <PackageReference Include="TensorFlow.NET" Version="0.100.5" />
  </ItemGroup>

</Project>

当我尝试运行代码时出现如下错误,我已按照官方指南在本机安装了TensorFlow:

Unhandled exception. System.DllNotFoundException: Unable to load shared library 'tensorflow' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable:
dlopen(/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.5/tensorflow.dylib, 0x0001)

以下是我的基础代码:


内容的提问来源于stack exchange,提问作者tmp dev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 19:28:14