IronPython.Runtime.UnboundNameException: '全局名称 'sin' 未定义' 错误
IronPython.Runtime.UnboundNameException: 'global name 'sin' is not defined' error
当我尝试使用数学函数 sin 时,铁 python 脚本出现问题。
var pyForSrc = @"def Test():
return sin(a)";
当我尝试执行上面的脚本时出现错误。
IronPython.Runtime.UnboundNameException: 'global name 'sin' is not defined'
我尝试使用 math.sin(a);也但是后来我得到如下错误
IronPython.Runtime.UnboundNameException: 'global name 'math' is not defined'.
当我尝试添加 Math.sin(a) 时,我也遇到了错误;
有人可以帮助我如何将数学库添加到 IronPython 脚本?
你应该写:
import math
在代码的顶部
当我尝试使用数学函数 sin 时,铁 python 脚本出现问题。
var pyForSrc = @"def Test():
return sin(a)";
当我尝试执行上面的脚本时出现错误。
IronPython.Runtime.UnboundNameException: 'global name 'sin' is not defined'
我尝试使用 math.sin(a);也但是后来我得到如下错误
IronPython.Runtime.UnboundNameException: 'global name 'math' is not defined'.
当我尝试添加 Math.sin(a) 时,我也遇到了错误; 有人可以帮助我如何将数学库添加到 IronPython 脚本?
你应该写:
import math
在代码的顶部