简体   繁体   中英

Debug python Visual Studio Startup very slow - load module

When start debug from Visual Studio, it takes like 2 minutes to hit the first line of python code. Apparently Visual Studio is busy loading python modules.

python.exe' (Win32): Loaded 'C:\\ProgramData\\Anaconda3\\python.exe'. Symbols loaded.

'python.exe' (Win32): Loaded 'xxxxx'. Cannot find or open the PDB file. ... many more ...

I tried below, no joy:

  1. Tools \\ Options \\ Debugging

    a) Enable Just My Code checked

    b) Just-In-Time Debugging - only selected Managed and Script

    c) Symbols

    • unchecked "Microsoft Symbol Servers"
    • "Load all modules, unless excluded" or "Load only specified modules" (tried both)

https://devblogs.microsoft.com/devops/make-debugging-faster-with-visual-studio/

  1. Reinstall Visual Studio (I tried both Community Edition, Standard Edition)
  2. Reboot my machine three times
  3. Delete all breakpoints
  4. Disable Resharper

Two more observations:

  1. I never had this issue prior to today

  2. Python Interactive Debugger stopped working today - it refuse to print anything!

    myDataFrame.head()

    print("hello")

Fixed!! I deleted my Visual Studio solution and project file. Create the python project brand new, all fixed!

Just in case anyone else is looking around,

I also had horrendous debug times (2+ minutes to get to the first line of code).

I was using an Anaconda deployment for numpy/scipy along with pybind11 to interface/debug C code.

I fixed my debug times by using a vanilla deployment of python (3.9.1) and installing the minimal requirements using pip. I believe it was taking so long because visual studio is searching for debug symbols that do not exist. Anaconda does not provide symbol libraries (nor will they according to their forums)

Debug times are now as fast as normal run times (<1s) and I'm no longer dreading hitting the little bug button.

在解决方案属性中禁用“启用本机代码调试”对我有帮助。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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