使用python multithreading.Pool 做多线程,遭遇bug3770,如何解?
伊谢尔伦
伊谢尔伦 2017-04-17 14:27:09
0
2
1186

使用python multithreading.Pool 做多线程,遭遇bug3770,如何解?

Python版本:2.7.3
系统版本:centos release 4.3
出错语句:pool = Pool(4)
错误信息:ImportError: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770

简单来说是python不支持操作系统中关于共享信号量的设置。看了些别人的帖子,也看了python官网对这个bug的解释,但是都解决不了现在的问题。
操作系统改不了,有什么方法能绕过这个问题呀,求明白人支招~~~

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
黄舟

Are you going to do multi-threading or multi-processing? I remember that the pool seems to be multi-process

迷茫

Attached is the standard answer:
Cause: /dev/shm is not mounted; something needs to be written during python installation to enable sem_open
Solution: (root permission is required; the following command is executed with the root account)

  1. Modify /etc/fstab and add: tmpfs /dev/shm tmpfs defaults 0 0

  2. mount /dev/shm

  3. chmod 777 /dev/shm

  4. Reinstall python (must reinstall, there is no way, check whether the device exists during installation, if it exists, you can use sem_open)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template