Mac上python多线程错误:...+[__NSPlaceholderDate initialize]...

问题描述

希望以守护进程的模式去运行某个 python 脚本。 该脚本中会开启多线程程序。

脚本为单线程时可正常运行, 脚本为多线程时报错:

objc[91498]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.
objc[91498]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

解决

参考

https://www.cnblogs.com/leocll/p/11008838.html

临时

// 在终端中执行以下命令
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

写入环境变量文件

Mac上python多线程错误:...+[__NSPlaceholderDate initialize]..._第1张图片

你可能感兴趣的:(Mac上python多线程错误:...+[__NSPlaceholderDate initialize]...)