简体   繁体   English

Spyder 3 for Python运行代码

[英]Spyder 3 for Python running code

I've been trying to run some code in Spyder using their idle, but I keep getting an error such as SyntaxError: invalid syntax. 我一直在尝试使用它们的空闲状态在Spyder中运行一些代码,但我不断收到诸如SyntaxError:无效语法的错误。 Assuming that the file requires 2 inputs, for example, img1.bmp, and an integer (ie python file.py img1.bmp 4). 假设该文件需要2个输入,例如img1.bmp和一个整数(即python file.py img1.bmp 4)。

The idle is a python interpreter, and it is giving you a python error SyntaxError: invalid syntax . idle是一个python解释器,它为您提供了python错误SyntaxError: invalid syntax You are already running python, so entering python file.py img1.bmp 4 would not make any sense. 您已经在运行python,因此输入python file.py img1.bmp 4毫无意义。 You would need to run that in a command prompt. 您需要在命令提示符下运行它。 If you want to run it in a python interpreter, you could import your file and call the functions as needed. 如果要在python解释器中运行它,则可以导入文件并根据需要调用函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM