简体   繁体   English

每次运行 jupyter 笔记本时,我是否必须重新启动 kernel?

[英]do i have to restart the kernel everytime I run a jupyter notebook?

I am completely new in data-science and the jupyter notebook world.我是数据科学和 jupyter notebook 世界的新手。 Is there any way to start from where I left on without restarting the whole notebook?有没有办法从我离开的地方开始而不重新启动整个笔记本?

ie I did some operations on a dataset and get a final_data.即我对一个数据集做了一些操作并得到一个final_data。 Whenever I want to use that final_data after shutting down and opening, I get NameError: name 'final_data' is not defined.每当我想在关闭和打开后使用该 final_data 时,我都会得到 NameError: name 'final_data' is not defined。 How to solve this?如何解决这个问题?

I think that's how the Jupyter Notebook works.我认为这就是 Jupyter Notebook 的工作原理。 You have to run all the notebook again.您必须再次运行所有笔记本。 I go to Cell>Run All after opening my notebook.打开我的笔记本后,我 go 到Cell>Run All

It depends whether you are using Google Colab or a simple Jupyter notebook, I think you are using simple Jupyter, however, I will discuss my experience with both.这取决于您使用的是 Google Colab 还是简单的 Jupyter 笔记本,我认为您使用的是简单的 Jupyter,但是,我将讨论我对两者的体验。

For Google Colab: Runtime is destroyed with inactivity and you have to run it again from the start.对于 Google Colab:运行时因不活动而被破坏,您必须从头开始再次运行它。

For Jupyter Notebook: If the notebook tab is open on your browser, the results will not be cleared with time (due to inactivity) as long as you close the tab itself.对于 Jupyter Notebook:如果笔记本选项卡在您的浏览器上打开,只要您关闭选项卡本身,结果就不会随着时间的推移(由于不活动)而被清除。 If you are shutting down/restarting your pc, you will lose the progress (number of lines which were compiled and run), and there is not an easy way to save the progress.如果您正在关闭/重新启动您的电脑,您将丢失进度(编译和运行的行数),并且没有简单的方法来保存进度。

The best way is to keep the Jupyter notebook tab open, even if you put your computer in sleep mode (by flipping the lid of your laptop), the data will be retained, until and unless you do not restart or shut down your PC.最好的方法是让 Jupyter 笔记本选项卡保持打开状态,即使您将计算机置于睡眠模式(通过翻转笔记本电脑的盖子),数据仍将保留,直到且除非您不重新启动或关闭您的 PC。

暂无
暂无

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

相关问题 为什么 Jupyter Notebook 中出现 Kernel 错误? - Why do I have a Kernel Error in Jupyter Notebook? 当本地模块中的代码发生更改时,我是否总是必须在 Jupyter Lab 中重新启动我的 kernel? - Do I always have to restart my kernel in Jupyter Lab when code in a local module changes? Jupyter 笔记本中的内核错误,我也尝试删除内核 - Kernel error in Jupyter notebook and i have tried deleting the kernels as well 当我运行代码时,jupyter notebook 的内核不断死亡 - jupyter notebook's kernel keeps dying when I run the code Linux Jupyter Notebook:“内核似乎已经死了。它会自动重启” - Linux Jupyter Notebook : "The kernel appears to have died. It will restart automatically" 如何在 Python Jupyter Notebook 的按钮中编码“重新启动内核并全部运行”? - How to code "Restart Kernel and Run all" in button for Python Jupyter Notebook? 如何在我的jupyter笔记本中添加python3内核? - How do I add a python3 kernel to my jupyter notebook? 如何在 IPython (Jupyter) Notebook 的远程机器上添加 kernel? - How do I add a kernel on a remote machine in IPython (Jupyter) Notebook? 每次运行 Jupyter Notebook 时,是否必须使用 fetch_openml 重新下载 MNIST? - Do I have to redownload MNIST with fetch_openml every time I run my Jupyter Notebook? 每次我运行“jupyter notebook”时,为什么我总是在 mac os 上得到这个? - Everytime i run “jupyter notebook”, why I always got this on mac os?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM