简体   繁体   English

如何从Visual Studio轻松运行python脚本

[英]How to easily run a python script from Visual Studio

Is there a way to easily run a currently active python file in Visual Studio? 有没有一种方法可以在Visual Studio中轻松运行当前活动的python文件? I'm used to Notepad++ in which I had customized it to run an active python file in cmd on ctrl+r which made testing code very easy and fast. 我习惯了Notepad ++,在其中我对其进行了自定义,以在ctrl + r上的cmd中运行活动的python文件,这使得测试代码非常容易和快捷。 If there was something similar I could do for Visual Studio, that would be wonderful. 如果我可以为Visual Studio做类似的事情,那就太好了。

Thanks! 谢谢!

Download the extension 'Code Runner'. 下载扩展“代码运行器”。 You may need to restart visual studio code after loading. 加载后,您可能需要重新启动Visual Studio代码。 Open your script in an editor window. 在编辑器窗口中打开脚本。 Hit the keys 'control-alt-n' and your script should run. 按下键“ control-alt-n”,您的脚本应该运行。 I just checked it on my mac and it ran fine. 我只是在Mac上检查了它,然后运行正常。

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

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