【发布时间】:2020-10-28 16:35:49
【问题描述】:
我在 Visual Studio Code 上用 Python 定义了一个函数,但是当我调用它时,会出现以下错误消息:
trin : The term «trin» is not recognized applet of command name,
function, script file or program executable. Check name's
spelling, or if an access path exists, check that the access
path is correct and try again.
At character Line:1 : 1
+ trin(1, 1, 1)
+ ~~~
+ CategoryInfo : ObjectNotFound: (trin:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我的脚本是:
def trin(a1, b1, a2, b2) :
if a1 == a2 and b1 == b2 :
print("The straight lines conincide.")
elif (a1*b2)-(a2*b1)==0 and a1!=a2 or b1!=b2 :
print("There is not intersections, the straight lines are parallel")
else :
x = (b2-b1)/(a2-a1)
print("The intersection point is (", x, " ; ", a1*x+b1, ")" )
我删除并重新安装了 vscode、Python 和我的其他 IDE/解释器。
【问题讨论】:
-
您没有在 Python 提示符下键入
trin(1, 1, 1),我认为错误消息来自 PowerShell。