【问题标题】:Unable to build Tensorflow for Scala using SBT (MacOS)无法使用 SBT (MacOS) 为 Scala 构建 TensorFlow
【发布时间】:2019-04-15 22:16:13
【问题描述】:

我正在尝试使用在 MacOS 上构建的 this 将 TensorFlow 包含在我的 Scala 项目中。

至于installation,他们提供了两种方式:

1) 在 SBT 构建中包含以下行:

libraryDependencies += "org.platanios" % "tensorflow" % "0.4.0" classifier "darwin-cpu-x86_64"

但是这并没有构建并给出以下错误:

unresolved dependency: org.platanios#tensorflow;0.4.0: not found

2) 从头开始​​构建 TensorFlow(我通过以下步骤完成):

  • 克隆 tensorflow git 存储库

  • 结帐分支 r1.12

  • 运行./configure

  • 使用 bazel 和以下命令构建:bazel build --config=opt --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=0 //tensorflow:libtensorflow.so

  • 在 LD_LIBRARY_PATH 中的目录中添加 libtensorflow.so

  • 使用 brew 安装 protobuf

但是,当我想在我的项目中导入 tensorflow 时仍然没有成功。

关于如何解决这个问题的任何想法?

【问题讨论】:

  • 根据第 1 点)尝试使用 tensorflow_2.12 而不仅仅是 tensorflow
  • 有效!非常感谢,您可以将您的解决方案作为答案,以便我将其标记为正确。
  • 只是好奇,你能试试这个,看看它是否有效? libraryDependencies += "org.platanios" %% "tensorflow" % "0.4.0" classifier "darwin-cpu-x86_64" 所以在组织和名称之间是%%,而不是单个%
  • 你可以试试libraryDependencies += "org.platanios" % "tensorflow_2.12" % "0.4.0" classifier "darwin-cpu-x86_64"libraryDependencies += "org.platanios" % "tensorflow_2.12" % "0.4.0"
  • @KevinLee 也可以,谢谢。

标签: macos scala tensorflow sbt


【解决方案1】:

我认为你只需要指定 scala 版本(希望是 2.12)所以把 tensorflow_2.12 而不是仅仅 tensorflow

【讨论】:

    猜你喜欢
    • 2013-05-24
    • 2012-12-06
    • 2021-09-19
    • 1970-01-01
    • 1970-01-01
    • 2011-11-09
    • 2020-05-30
    • 1970-01-01
    • 2017-09-08
    相关资源
    最近更新 更多