为什么 PyPy 中没有名为 queue 的模块?

Why is there no module named queue in PyPy?

我需要使用 PyPy,因为速度至关重要。我想使用优先级队列,通常使用 Python 我会使用 queue 模块,但 PyPy 给我一个错误。

import queue

错误:

import queue
ImportError: No module named queue

为什么这个模块不可用?我认为 PyPy 与 Python 的标准库兼容。

感谢@user2357112supportsMonica 我找到了解决方案。只需使用 heapq.