Python 2.7.6'没有名为dummy'

时间:2015-04-09 15:26:27

标签: 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)

    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中的默认模块?我是否需要手动安装此模块?

0 个答案:

没有答案