[英]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.