简体   繁体   English

我需要从BAT文件在IDLE中运行python脚本

[英]I need to run a python script in IDLE from a BAT file

I have a python script which creates some images. 我有一个python脚本,可以创建一些图像。 The script runs in Ipython IDLE as expected, however then I call IDLE from the cmd line, and include the name of the script, the script loads but does not execute. 该脚本按预期在Ipython IDLE中运行,但是随后我从cmd行调用IDLE,并包含脚本的名称,该脚本会加载但不会执行。 If I hit F5(run Module) then the program runs, but I wonder if it is possible to make the script run without having to press F5. 如果我按下F5(运行模块),那么程序将运行,但是我想知道是否有可能在不必按F5的情况下运行脚本。

为什么不在命令行中使用“ python script_file.py”直接从命令行运行脚本?

您可以在这里https://docs.python.org/2/library/idle.html#command-line-usage尝试使用:

idle -r yourscript.py

Are you totally sure thet your script needs to be run from IDLE? 您完全确定您的脚本需要从IDLE运行吗? You can run it directly with your Python interpreter like this: 您可以使用Python解释器直接运行它,如下所示:

С:\<path_to_your_python_interpreter> <path_to your_script>

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

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