swift - 无法在 Swift Colab 中使用 %install

标签 swift jupyter-notebook google-colaboratory

我尝试在 Google Colab 上安装一个新的 Swift 库

%install '.package(url: "https://github.com/IBM-Swift/BlueCryptor.git", from: "1.0.28")' Cryptor

然后,出现错误

...
error: toolchain is invalid: could not find the `swiftc` at expected path /swift/toolchain/usr/bin/swiftc
Install Error: swift-build returned nonzero exit code 1.

但我检查 swiftc 确实存在于 /swift/toolchain/usr/bin 中。 这是一个 Colab notebook 证明错误。

请帮忙。

最佳答案

现在我将它更新到最新的 Swift 版本。通过运行此笔记本:

https://colab.research.google.com/github/tensorflow/swift/blob/master/notebooks/install_latest_swift.ipynb

没有错误了。所以,只需要更新它。

您也可以使用此代码从 Swift notebook 完成所有操作。

import Python
Python.import("subprocess").getoutput("""
rm -rf /swift
mkdir -p /swift/toolchain
wget -nv -O- https://storage.googleapis.com/s4tf-kokoro-artifact-testing/latest/swift-tensorflow-DEVELOPMENT-cuda10.0-cudnn7-ubuntu18.04.tar.gz | tar xzf - -C /swift/toolchain
wget -nv -O- https://storage.googleapis.com/s4tf-kokoro-artifact-testing/latest/swift-jupyter.tar.gz | tar xzf - -C /swift
python3 /swift/swift-jupyter/register.py --swift-toolchain /swift/toolchain
apt-get install libblocksruntime-dev
""")

关于swift - 无法在 Swift Colab 中使用 %install,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56866369/

相关文章:

tensorflow - TF/Keras 错误 : InputLayer not a Checkpointable

arrays - 将函数结果打印到数组中

ipython - Jupyter notebook ---(<hr> 标签)呈现不同的颜色

swift - 初始化参数中的 self

javascript - 在 Jupyter notebook 中用 python 包装 JS 函数的解决方法

python-3.x - 在 jupyter 笔记本单元格中使用单击库

python - 如何使用 API 与 Google Colab 交互?

python - 如何在Google Colab中显示点击图片的点的坐标?

ios - 模棱两可的 "use of unresolved identifier"错误?

swift - 无法使用 XCTAssertEqual 在 Swift 中将表达式类型 void 转换为整数类型