简体   繁体   English

在 Watson Studio 中共享 Python Notebook

[英]Sharing Python Notebooks in Watson Studio

I have a few notebooks in my Watson studio project.我的 Watson Studio 项目中有一些笔记本。 They use a common set of function definitions.它们使用一组通用的函数定义。 I'm constantly refining these common function definitions so I want them to be in a notebook.我不断完善这些常见的函数定义,所以我希望它们在笔记本中。 How can I share this notebook with the other notebooks?如何与其他笔记本共享此笔记本?

You cannot include notebooks from other notebooks in Watson Studio on Cloud.您不能在 Watson Studio on Cloud 中包含来自其他笔记本的笔记本。

What you can do is let a notebook write a file with your shared function to the project storage.您可以做的是让笔记本将包含您共享功能的文件写入项目存储。 Other notebooks can fetch that file from project storage, save it to the transient disk storage, and import it from there.其他笔记本可以从项目存储中获取该文件,将其保存到临时磁盘存储中,然后从那里导入。 The project-lib utility will help you with accessing the project storage. project-lib实用程序将帮助您访问项目存储。

You may use the %save magic to write functions from different cells to a .py file on disk.您可以使用%save魔法将不同单元格的函数写入磁盘上的.py文件。 Then the final cell of the notebook can load that file and write it to the project storage.然后笔记本的最后一个单元格可以加载该文件并将其写入项目存储。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM