在 coremltools 转换中指定 swift 版本

Specifying swift version in coremltools conversion

是否可以指定 coremltools 写入 mlmodel 的 swift 版本?我安装了 macOS 10.14 beta,正在尝试将不支持 swift 4.2 的 coreml 模型加载到 iOS 11.x。当我将模型加载到 Xcode 时,出现错误:

Error generating model class : unrecognized Swift version "4.2". Expected one of: 3.0, 3.1, 3.2 or 4.0"

问题是您当前使用的是 swift 版本 >4.0。 您可以使用 Xcode 中的工具链功能来使用 SWIFT 4.0 版本。

为此,请在此处下载 https://swift.org/download/#releases 并安装。

如果您需要帮助安装版本 https://m.pardel.net/using-old-versions-of-swift-in-xcode-4dd46644a257

,请勾选此项

希望对您有所帮助。