Mil*_*les 7 python ipython jupyter-notebook
我正在 Google Collab 中处理这个 python 笔记本:https : //github.com/AllenDowney/ModSimPy/blob/master/notebooks/chap01.ipynb
我不得不更改配置行,因为原始中所述的配置行出错:
# Configure Jupyter to display the assigned value after an assignment
# Line commented below because errors out
# %config InteractiveShell.ast_node_interactivity='last_expr_or_assign'
# Edit solution given below
%config InteractiveShell.ast_node_interactivity='last_expr'
Run Code Online (Sandbox Code Playgroud)
但是,我认为原始语句是为了显示赋值的值(如果我没记错的话),所以当我在笔记本中运行以下单元格时,我应该看到一个输出:
meter = UNITS.meter
second = UNITS.second
a = 9.8 * meter / second**2
Run Code Online (Sandbox Code Playgroud)
如果是这样,我怎样才能让 google collab 上的笔记本显示作业的输出?
Google Colab 尚未升级到最新的 IPython 版本 - 如果您明确升级
!pip install -U ipython
Run Code Online (Sandbox Code Playgroud)
那么last_expr_or_assign就可以工作了。
| 归档时间: |
|
| 查看次数: |
3191 次 |
| 最近记录: |