本文主要是介绍Python非root用户启动python multiprocessing的semlock,提示没有权限的解决方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
使用进程间通信的时候
Python报错为
<span style="font-size:18px;">Traceback (most recent call last):File "web_game_sign.py", line 483, in <module>count = multiprocessing.Value('i', 1)File "/usr/lib64/python2.6/multiprocessing/__init__.py", line 248, in Valuereturn Value(typecode_or_type, *args, **kwds)File "/usr/lib64/python2.6/multiprocessing/sharedctypes.py", line 75, in Valuelock = RLock()File "/usr/lib64/python2.6/multiprocessing/__init__.py", line 178, in RLockreturn RLock()File "/usr/lib64/python2.6/multiprocessing/synchronize.py", line 142, in __init__SemLock.__init__(self, RECURSIVE_MUTEX, 1, 1)File "/usr/lib64/python2.6/multiprocessing/synchronize.py", line 49, in __init__sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue)
OSError: [Errno 13] Permission denied</span>
原因是因为用户没有shared memory(/dev/shm)的读写权限,需要将/dev/shm的权限改成:
drwxrwxrwx 2 root root 80 Mar 25 11:39 /dev/shm
这篇关于Python非root用户启动python multiprocessing的semlock,提示没有权限的解决方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!