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

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

使用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的解释,但是都解决不了现在的问题。
操作系统改不了,有什么方法能绕过这个问题呀,求明白人支招~~~


你是要做多线程了还是多进程?我记得pool好像是多进程的哦


附上标准答案:
原因:没有挂载/dev/shm;python安装时需要写入东西,才能开启sem_open
解决办法:(需要root权限;以下命令root账号执行)

  1. 修改/etc/fstab 增加:tmpfs /dev/shm tmpfs defaults 0 0

  2. mount /dev/shm

  3. chmod 777 /dev/shm

  4. 重装python (必须重装,没办法,安装时检查该设备是否存在,存在则可以使用sem_open)

【热门文章】
【热门文章】