当我更改代码时,ipython Notebook没有更新 [英] ipython notebook is not updating when I change my code

查看:76
本文介绍了当我更改代码时,ipython Notebook没有更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我在使用ipython笔记本时遇到了一个奇怪的问题,不确定该怎么做.通常,当我运行部分代码时,如果有错误,我会追溯它,进行修复,然后重新运行代码.我在做类似的事情,但是即使在更改了代码之后,看起来也没有任何变化!

So, I ran into a weird issue using an ipython notebook and not sure what to do. Normally, when I run a part of the code, if there is an error, I would trace it back, fix it, and then re-run the code. I was doing a similar thing but even after making changes to the code, it looks like nothing is changing!

这里是示例...我使用的是Python 3.5,因此xrange消失了.然后导致引发错误:

Here is the example... I am using Python 3.5 so xrange is gone. This then caused an error to be thrown:

XXXX
     24     XXXX
     25     XXXX
---> 26     for t in xrange(0,len(data),1):
     27 
     28         XXXX

     NameError: name 'xrange' is not defined

但是更改我的代码(您可以在第26行的区别下面看到)后,出现相同的错误!

but after changing my code (which you can see below the difference in line 26), the same error pops up!

XXXX
     24     XXXX
     25     XXXX
---> 26     for t in range(0,len(data),1):
     27 
     28     XXX

     NameError: name 'xrange' is not defined

关于为什么会发生这种情况的任何想法?

Any ideas on why this would be happening?

推荐答案

Thomas K 所说,您可能在未导入的外部文件中进行了更改.在这种情况下,ipython Notebook中有一个非常有用的命令,称为 autoreaload .使用自动重载,每当您修改外部文件时,您都不必再次导入它,因为扩展名会为您处理它.有关更多信息,请检查: ipython自动重新加载.

As Thomas K said, you're probably making a change in an external file that was not imported. There is a very useful command in ipython notebook for such cases, called autoreaload. With autoreaload, whenever you modify an external file you do not have to import it again because the extension takes care of it for you. For more information check: ipython autoreload.

这篇关于当我更改代码时,ipython Notebook没有更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆