AttributeError: module 'socketserver' has no attribute 'ForkingMixIn'

AttributeError: module 'socketserver' has no attribute 'ForkingMixIn'

首先我尝试了 SocketServer class。然后我才知道 Python2 中可以使用 SocketServer。对于 Python3,您需要将其设为小写,例如 socketserver。我正在尝试实现一个可以响应多个线程并且不会阻止调用的套接字服务器。

服务器代码如下

class ForkingServer(socketserver.ForkingMixIn, socketserver.TCPServer):
  pass

但它给出了上述错误。有人知道吗?

哦,我刚刚从屏幕截图中了解到您在 Windows。 ForkingMixIn class 在 Windows 上不可用,因为 Windows 上没有 fork()。这个也提到in the docs.