Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 类ForkAwareLocal(threading.local):AttributeError:';模块';对象没有属性';地方的_Python_Multithreading_Python Multiprocessing - Fatal编程技术网

Python 类ForkAwareLocal(threading.local):AttributeError:';模块';对象没有属性';地方的

Python 类ForkAwareLocal(threading.local):AttributeError:';模块';对象没有属性';地方的,python,multithreading,python-multiprocessing,Python,Multithreading,Python Multiprocessing,我是python新手。 我正在尝试手册中的这段代码,但遇到了这个错误。 不知道为什么。 任何帮助都将不胜感激。 Thx 阿比 代码片段 错误 [root@localhostmpls perf]#python thru 1.py 回溯(最近一次呼叫最后一次): 文件“thr_1.py”,第4行,在 来自多处理导入池 文件“/usr/lib64/python2.7/multiprocessing/_init__uuu.py”,第65行,在 从multiprocessing.util导入子调试,子警

我是python新手。 我正在尝试手册中的这段代码,但遇到了这个错误。 不知道为什么。 任何帮助都将不胜感激。 Thx

阿比 代码片段
错误
[root@localhostmpls perf]#python thru 1.py
回溯(最近一次呼叫最后一次):
文件“thr_1.py”,第4行,在
来自多处理导入池
文件“/usr/lib64/python2.7/multiprocessing/_init__uuu.py”,第65行,在
从multiprocessing.util导入子调试,子警告
文件“/usr/lib64/python2.7/multiprocessing/util.py”,第340行,在
类ForkAwareLocal(threading.local):
AttributeError:“模块”对象没有属性“本地”
异常属性错误:“\u shutdown”处于忽略状态

操作系统等 [root@localhostmpls perf]#uname-a Linux localhost.localdomain 3.4.4464bit-smp-xp1.1-allpatch#1 smp周三10月15日17:34:02美国东部夏令时2014年x86_64 x86_64 x86_64 GNU/Linux

[root@localhostmpls perf]#python-V Python 2.7.5
[root@localhostmpls perf]

您似乎有一个名为
threading.py的文件

这是通过
多处理
导入的,而不是内置的
线程


将文件重命名为其他文件并删除
.pyc

您似乎有一个名为
threading.py

这是通过
多处理
导入的,而不是内置的
线程

将文件重命名为其他文件并删除
.pyc

#/usr/bin/python
# -*- coding: utf-8 -*-

from multiprocessing import Pool
def f(x):
return x*x

p = Pool(1)
p.map(f, [1, 2, 3])
[root@localhost mpls-perf]# python thr_1.py 
Traceback (most recent call last):
  File "thr_1.py", line 4, in <module>
    from multiprocessing import Pool
  File "/usr/lib64/python2.7/multiprocessing/__init__.py", line 65, in <module>
    from multiprocessing.util import SUBDEBUG, SUBWARNING
  File "/usr/lib64/python2.7/multiprocessing/util.py", line 340, in <module>
    class ForkAwareLocal(threading.local):
AttributeError: 'module' object has no attribute 'local'
Exception AttributeError: '_shutdown' in <module 'threading' 
from '/root/nfs/zebos/tests/mpls-             perf/threading.pyc'> ignored