Python multiprocessing.dummy为什么属性错误:';模块';对象没有属性';假人';

Python multiprocessing.dummy为什么属性错误:';模块';对象没有属性';假人';,python,module,multiprocessing,python-import,Python,Module,Multiprocessing,Python Import,我在Python中遇到了一件奇怪的事情: >>> import multiprocessing >>> thread_pool = multiprocessing.dummy.Pool() Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'd

我在Python中遇到了一件奇怪的事情:

>>> import multiprocessing

>>> thread_pool = multiprocessing.dummy.Pool()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'dummy'
导入多处理 >>>thread_pool=multiprocessing.dummy.pool() 回溯(最近一次呼叫最后一次): 文件“”,第1行,在 AttributeError:“模块”对象没有属性“虚拟” 但是,当我尝试以下操作时:

>>> from multiprocessing.dummy import Pool as ThreadPool
>>> ThreadPool()
<multiprocessing.pool.ThreadPool object at 0x7faf9308d4a8>
>>从multiprocessing.dummy导入池作为线程池
>>>线程池()

导入多处理.dummy >>>multiprocessing.dummy.Pool() 一切都好。
我知道
导入xxx
和来自xxx导入的
之间的区别,我想知道为什么它会引发AttributeError我的问题是为什么在导入多处理后不能使用
多处理.dummy

多处理中没有导入
多处理.dummy
包。\uuuu init\uuuuuuuuuy
。因此,

>>> import multiprocessing

>>> thread_pool = multiprocessing.dummy.Pool()
不起作用。形成文档字符串:

# This package is intended to duplicate the functionality (and much of
# the API) of threading.py but uses processes instead of threads.  A
# subpackage 'multiprocessing.dummy' has the same API but is a simple
# wrapper for 'threading'.

我猜这个小包装是故意隐藏起来的,以防止人们意外使用它

我尝试将
'dummy'
添加到
\uuuuuuuuuuuuuuuuuuuuuuuuuuuu.py
中的
多处理中。dummy
仍然不起作用。
# This package is intended to duplicate the functionality (and much of
# the API) of threading.py but uses processes instead of threads.  A
# subpackage 'multiprocessing.dummy' has the same API but is a simple
# wrapper for 'threading'.