Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.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
Ipython IPY与directview并行错误_Ipython_Ipython Parallel - Fatal编程技术网

Ipython IPY与directview并行错误

Ipython IPY与directview并行错误,ipython,ipython-parallel,Ipython,Ipython Parallel,运行此代码时,出现以下错误: from ipyparallel import error, AsyncHubResult, DirectView as dv, Reference @dv.parallel(block=True) def np_std_par(x): return np_std(x) TypeError: unbound method parallel() must be called with DirectView instance as first argume

运行此代码时,出现以下错误:

from ipyparallel import error, AsyncHubResult, DirectView as dv, Reference

@dv.parallel(block=True)
def np_std_par(x):
    return np_std(x)

TypeError: unbound method parallel() must be called with 
DirectView instance as first argument (got nothing instead)
我如何使用装饰器?
听起来不清楚。

dv
,正如在第一个代码块(及以上)中所写的,实际上不是
DirectView

从ipyparallel导入DirectView作为dv
打印(类型(dv))
DirectView
不需要导入,而是

import-ipyparallel
client=ipyparallel.client()
dv=客户端[:]
打印(类型(dv))

现在,装饰器将按预期执行。(虽然,看起来您可能必须在函数中导入
np_std
,或者使用
require
装饰器,但这完全是另一个问题,我建议您仔细阅读文档中的示例,以便更加熟悉)

dv
,如第一个代码块(及以上)中所述,实际上不是
DirectView

从ipyparallel导入DirectView作为dv
打印(类型(dv))
DirectView
不需要导入,而是

import-ipyparallel
client=ipyparallel.client()
dv=客户端[:]
打印(类型(dv))
现在,装饰器将按预期执行。(虽然看起来您可能需要在函数中导入
np_std
,或者使用
require
装饰器,但这完全是另一个问题,我建议您仔细阅读文档中的示例,以便更加熟悉)