【问题标题】:Is there a way to use a variable inspector on Google Colab?有没有办法在 Google Colab 上使用变量检查器?
【发布时间】:2020-08-13 10:10:56
【问题描述】:

这是我第一次在 Google Colab 上工作。 是否可以在 Google Collab 中使用变量检查器? 如果是这样,如何?

谢谢。

【问题讨论】:

标签: jupyter-notebook google-colaboratory


【解决方案1】:

更新:自 2022 年 2 月 22 日起,Colab 拥有自己的变量检查器。 您可以从左侧面板访问它。


是的。我就是这样做的。

将此代码放入一个代码单元并运行它。

from google.colab import output
#I don't know why nbextensions don't work with python3.6 
with output.temporary():
  !pip install --upgrade git+https://github.com/Kreijstal/colab_inspector.git 
  !python2.7 -m pip install --upgrade git+https://github.com/blois/colab_inspector.git #yes, really.
  !jupyter nbextension install --py inspector

import inspector

# open a scratch cell (Ctrl+Alt+N)
# run there
# inspector.watch_globals()

打开一个临时单元格(Ctrl+Alt+N)

在上面运行

inspector.watch_globals()

当您在左侧编码时,您将在右侧看到自动更新的变量。您甚至可以扩展字典和其他内容。

参考资料:

关键词: Google Colab,变量浏览器检查器可视化

【讨论】:

  • 非常感谢擦!
猜你喜欢
  • 2019-11-02
  • 1970-01-01
  • 2020-11-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-04-04
相关资源
最近更新 更多