Unity项目安装TensorFlow.Keras失败:无法解析PureHDF依赖
检查Unity的NuGet源配置
打开Unity的Package Manager,点击右上角齿轮图标→Advanced Project Settings→Package Sources,确认已添加完整的nuget.org源(地址:https://api.nuget.org/v3/index.json),并且将其优先级调整到Microsoft Visual Studio Offline Packages之上。手动导入PureHDF包
直接下载PureHDF的.nupkg安装包,然后在Unity的Package Manager中选择「Add package from disk」,导入该文件后再重新安装TensorFlow.Keras。调整Unity的.NET运行时版本
进入Edit→Project Settings→Player→Other Settings→Configuration,将Scripting Runtime Version设置为.NET 4.x Equivalent,Api Compatibility Level改为.NET Standard 2.1或更高版本,确保和依赖包的.NET版本要求匹配。清理NuGet缓存
打开命令提示符,执行命令:dotnet nuget locals all --clear,清理本地NuGet缓存后重启Unity,再尝试安装操作。借助NuGetForUnity插件安装
如果Unity自带的NuGet集成不好用,安装NuGetForUnity插件,它能更灵活地处理NuGet包的依赖关系,提升安装成功率。
内容的提问来源于stack exchange,提问作者Entretoize

