有没有办法在Google Colab上使用变量检查器?

时间:2020-08-13 10:10:56

标签: jupyter-notebook google-colaboratory

这是我第一次使用Google Colab。 是否可以在Google Collab中使用变量检查器? 如果可以,怎么办?

谢谢。

1 个答案:

答案 0 :(得分:0)

是的。这就是我的方法。

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

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()

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

enter image description here

参考:

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