debugging Visual Studio 2022中的Python编译器不工作

yxyvkwin  于 2023-10-24  发布在  Python
关注(0)|答案(1)|浏览(169)

我通常使用Visual Studio Community 2022作为我的IDE进行编程有一次,我有一些小的自动化任务,用Python比用C++更快、更容易完成。所以我从Visual Studio安装了Python开发工作负载。但是我无法从Visual Studio中运行我的代码,不得不手动通过控制台运行它。由于这是一个我从来没有真正尝试过去弥补。
现在我又回到了用python写代码,又遇到了同样的问题。经过一些研究,我发现这个.net question和我的问题很相似,one of the answers实际上是python的,帮助我解决了这个问题。我遵循这个msdn page来让它工作。我终于不仅可以在Visual Studio中编写代码,而且还可以通过它运行我的代码。
但是现在我试着实际使用调试器(我设置了一些断点),注意到执行并没有停止,所以我尝试通过F11“Step Into”,再次得到一些错误,类似于this one

未找到来源

  • python.c未找到 *

您需要找到python. c来查看当前调用堆栈帧的源代码
选项:

  • 手动定位pyhton.c
  • 查看拆卸

更多信息

  • 来源搜索信息 *
Locating source for 'D:\a\1\s\Programs\python.c'. Checksum: SHA256 {3d e 15 d4 9a 77 5a 8d 50 af a6 b5 ed d4 4 ba d2 d7 9a f7 92 40 5c 76 84 70 7b c5 9 80 63 85}
The file 'D:\a\1\s\Programs\python.c' does not exist.
Looking in script documents for 'D:\a\1\s\Programs\python.c'...
Looking in the Edit-and-Continue directory 'D:\Programs\WebAutomationTest\enc_temp_folder\'...
The file with the matching checksum was not found in the Edit-and-Continue directory.
Looking in the projects for 'D:\a\1\s\Programs\python.c'.
The file was not found in a project.
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cvt\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\msclr\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\sys\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\crt\src\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\crt\src\x64\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\crt\src\arm\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\crt\src\concrt\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\crt\src\i386\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\crt\src\linkopts\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\crt\src\stl\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\crt\src\vccorlib\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\crt\src\vcruntime\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\atlmfc\src\mfc\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\atlmfc\src\atl\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\atlmfc\include\'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\atlmfc\src\mfc'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\atlmfc\src\mfcm'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\atlmfc\src\atl'...
Looking in directory ''...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\crt\src'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\src'...
Looking in directory 'C:\Program Files (x86)\Windows Kits\10\Source\10.0.22000.0\ucrt'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\include'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\atlmfc\include'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include'...
Looking in directory 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt'...
Looking in directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\UnitTest\include'...
Looking in directory 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um'...
Looking in directory 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\shared'...
Looking in directory 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\winrt'...
Looking in directory 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\cppwinrt'...
Looking in directory 'C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\Include\um'...
Searching for documents embedded in the symbol file.
An embedded document was not found.
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: D:\a\1\s\Programs\python.c.
The debugger could not locate the source file 'D:\a\1\s\Programs\python.c'.
dly7yett

dly7yett1#

就在我准备发布这个问题的时候,我想再次尝试“Step Into”,看看到底是什么行为,它突然起作用了。我再次检查了我之前设置的选项/属性,并禁用“Enable native code debugging”,我根据this post启用了它。

相关问题