简体   繁体   English

OSError: [Errno 24] 打开的文件太多 - OS Mojave

[英]OSError: [Errno 24] Too many open files - OS Mojave

So, I'm writing a script to take a certain dataset, sample it 100 times using different random seeds, completing all these datasets and then getting the mean error.所以,我正在编写一个脚本来获取某个数据集,使用不同的随机种子对其进行 100 次采样,完成所有这些数据集,然后获得平均误差。 However, whenever I try to run the script I end up with the error OSError: [Errno 24] Too many open files但是,每当我尝试运行脚本时,我都会遇到错误 OSError: [Errno 24] Too many open files

I don't understand what I can do to fix this (if I should do something in the script or in to the system and what).我不明白我能做些什么来解决这个问题(如果我应该在脚本或系统中做一些事情以及什么)。 I'm using Python 3 with macOS Mojave.我在 macOS Mojave 中使用 Python 3。 Anybody has a clue?有人有线索吗?

The number of open files you're allowed can be increased by using ulimit eg in bash you could do: ulimit -n This will probably print out 256 meaning that at one time a maximum of 256 file descriptors are allowed to be open.可以通过使用ulimit来增加允许打开的文件数,例如在 bash 中,您可以这样做: ulimit -n这可能会打印出 256,这意味着一次最多允许打开 256 个文件描述符。

Increase the limit: ulimit -n 30000 # 30,000 open files allowed增加限制: ulimit -n 30000 # 30,000 open files allowed

This sort of thing is generally done on systems running something like server programs that need a file descriptor (a socket descriptor) for each concurrent connection being handled.这类事情通常在运行类似服务器程序的系统上完成,这些程序需要为每个正在处理的并发连接提供一个文件描述符(套接字描述符)。

However, if you post the code there might be another way to fix this.但是,如果您发布代码,则可能有另一种方法来解决此问题。 It doesn't sound like you want/need multiple file descriptors open at the same time.这听起来不像您想要/需要同时打开多个文件描述符。

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

相关问题 OSError:[Errno 24]打开的文件太多 - OSError: [Errno 24] Too many open files OSError:[Errno 24]太多打开的文件python,ubuntu - OSError: [Errno 24] Too many open files python , ubuntu OSError: [Errno 24] 使用 Nibabel 打开的文件太多 - OSError: [Errno 24] Too many open files using Nibabel slackclient OSError:[Errno 24]打开的文件太多 - slackclient OSError: [Errno 24] Too many open files OSError: [Errno 24] 打开的文件太多; 在 python; 难以调试 - OSError: [Errno 24] Too many open files; in python; difficult to debug OSError: [Errno 24] 通过 Django admin 上传 9000+ csv 个文件时打开的文件太多 - OSError: [Errno 24] Too many open files when uploading 9000+ csv files through Django admin Django从一个图像域保存到另一个图像域:OSError:[Errno 24]打开的文件太多 - Django saving from one imagefield to another: OSError: [Errno 24] Too many open files 多处理“OSError:[Errno 24] 打开的文件太多”:如何清理作业和队列? - Multiprocessing "OSError: [Errno 24] Too many open files": How to clean up jobs and queues? OSError:[Errno 24]从终端调用脚本时打开的文件太多 - OSError: [Errno 24] Too many open files when invoking script from terminal OSError:[Errno 24]在Twisted中使用Reactor.run()时打开的文件过多 - OSError: [Errno 24] Too many open files when using reactor.run() in Twisted
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM