简体   繁体   English

Visual Studio 2017 Python无法调试文件

[英]Visual Studio 2017 Python can't debug files

I am using Visual Studio 2017 with Python. 我将Visual Studio 2017与Python结合使用。 When I want to run my file, I have to do Project > 'Start with Debugging' or Project > 'Start without Debugging' and there are no shortcuts for these, so it's very inconvenient to run my files. 当我想运行我的文件时,我必须执行Project>'Start with Debugging'或Project>'Start on Debugging',并且没有捷径,因此运行文件非常不便。 It is fine to set projects as 'StartUp project' and then run with F5 (Debug > Start Debugging) but can't I do it with just my files (File > New > File..)? 可以将项目设置为“启动项目”,然后使用F5运行(调试>开始调试),但是我不能只用我的文件(文件>新建>文件..)来做吗?

In Visual Studio 2017, we could start debug a Python project with shortcuts of F5 (Start with Debugging) and Ctrl + F5 (Start without Debugging). 在Visual Studio 2017中,我们可以使用F5(从调试开始)和Ctrl + F5(从无调试开始)的快捷方式开始调试Python项目。 It is debugging for project. 它正在调试项目。

The debugging for a Python file doesn't have shortcuts by default. 默认情况下,Python文件的调试没有快捷方式。 You need to right-click the file and choose Start with Debugging or Start without Debugging. 您需要右键单击该文件,然后选择“开始进行调试”或“开始进行不进行调试”。

If you just want to debug one of the Python files, you could set the file as Startup file through right-click the file -> choose Set as Startup file. 如果只想调试其中一个Python文件,则可以通过右键单击该文件将其设置为Startup文件->选择Set as Startup file。 Then you can debug this file through F5 or Ctrl + F5 until you set another file as startup file. 然后,您可以通过F5或Ctrl + F5调试此文件,直到将另一个文件设置为启动文件为止。

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

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