如何增加 Jupyter notebook 内存限制? [英] How to increase Jupyter notebook Memory limit?

查看:540
本文介绍了如何增加 Jupyter notebook 内存限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 10 上使用带有 Python3 的 jupyter notebook.我的电脑有 8GB 内存,至少有 4GB 的内存是免费的.

I am using jupyter notebook with Python3 on windows 10. My computer has 8GB RAM and at least 4GB of my RAM is free.

但是当我想用这个命令制作一个大小为 6000*6000 的 numpy ndArray 时:np.zeros((6000, 6000), dtype='float64')我得到了这个:无法分配形状为 (6000, 6000) 且数据类型为 float64 的数组

But when I want to make a numpy ndArray with size 6000*6000 with this command: np.zeros((6000, 6000), dtype='float64') I got this : Unable to allocate array with shape (6000, 6000) and data type float64

我认为这不会使用超过 100MB 的 RAM.我试图改变这个数字,看看会发生什么.我可以制作的最大数组是 (5000,5000).我在估计需要多少 RAM 时出错了吗?

I don't think this could use more then 100MB RAM. I tried to change the number to see what happens. The biggest array I can make is (5000,5000). Did I make a mistake in estimating how much RAM I need?

推荐答案

Jupyter notebook 有一个默认的内存限制大小.您可以尝试按照以下步骤增加内存限制:
1) 使用命令生成配置文件:

Jupyter notebook has a default memory limit size. You can try to increase the memory limit by following the steps:
1) Generate Config file using command:

jupyter notebook --generate-config

2) 打开位于 'jupyter' 文件夹内的 jupyter_notebook_config.py 文件并编辑以下属性:

2) Open jupyter_notebook_config.py file situated inside 'jupyter' folder and edit the following property:

NotebookApp.max_buffer_size = your desired value

记得去掉属性值前的‘#’.
3) 保存并运行 jupyter notebook.它现在应该使用设置的内存值.另外,不要忘记从 jupyter 文件夹中运行 notebook.

Remember to remove the '#' before the property value.
3) Save and run the jupyter notebook. It should now utilize the set memory value. Also, don't forget to run the notebook from inside the jupyter folder.

或者,您可以使用以下命令简单地运行 Notebook:

Alternatively, you can simply run the Notebook using below command:

 jupyter notebook --NotebookApp.max_buffer_size=your_value

这篇关于如何增加 Jupyter notebook 内存限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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