Python 2.7.6';没有名为dummy'的模块;

Python 2.7.6';没有名为dummy'的模块;,python,python-2.7,python-module,Python,Python 2.7,Python Module,我正在练习多线程。我在网上找到了一个教程 from multiprocessing.dummy import Pool def calcPi_thread(nuFutures,tries,n): ts = time.time() #define the Pool p = Pool(n) #use multi-thread to run function 'test' result = p.map(test,[tries]*nbFutures)

我正在练习多线程。我在网上找到了一个教程

from multiprocessing.dummy import Pool
def calcPi_thread(nuFutures,tries,n):
    ts = time.time()

    #define the Pool
    p = Pool(n)
    #use multi-thread to run function 'test'
    result = p.map(test,[tries]*nbFutures)

    ret = 4.*sum(result)/float(nbFutures*tries)
    span = time.time()-ts
    print "Time Spend for Mutli-Thread(Thread=" + str(n) + ") is " + str(span)
    return ret

当我运行上面的代码时,它说“没有名为dummy的模块”。multiprocessing.dummy是Python 2.7.6中的默认模块吗?是否需要手动安装此模块?

我假设错误在第一行,其余代码与此无关。导入在Ubuntu python 2.7.6上对我有效。你能发布完整的回溯吗?另外,您的脚本没有命名为
multiprocessing.py
是吗?@jedwards如果这就是问题所在,那么您就是一个向导。@jedwards OP还没有返回,我会继续说您是一个向导。@jedwards是的……这就是问题所在……我有多蠢……哈哈