只需两行即可重现它,如下所示:
from multiprocessing import Event
e=Event()
给出:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/work/python2.7/lib/python2.7/multiprocessing/__init__.py", line 206, in Event
from multiprocessing.synchronize import Event
File "/home/work/python2.7/lib/python2.7/multiprocessing/synchronize.py", line 33, in <module>
" function, see issue 3770.")
ImportError: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.
但是,错误消息不是真的。如果 Python 是由 root 安装的,并且我以 root 身份登录,它运行良好。
我猜普通用户缺乏运行 API 的权限,但我不知道是哪个。
如何在 linux2.6.9 上使用 Python 2.7.1 解决这个问题?