a77*_*8h6 8 python python-3.x visual-studio-code vscode-debugger
尝试使用多处理模块来运行一些代码。我需要使用 python 调试器来传递'-Xfrozen_modules=off'但使用args
or pythonArgs
inlaunch.json
似乎不起作用。
0.01s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
Run Code Online (Sandbox Code Playgroud)
我使用and传递了“-Xfrozen_modules=off”,但这不起作用。args
pythonArgs
launch.json
Python 3.11.2
小智 7
我最终将环境变量“PYDEVD_DISABLE_FILE_VALIDATION”添加到我的 launch.json 文件中。例如:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true,
"env": {
"PYDEVD_DISABLE_FILE_VALIDATION": "1"
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
小智 0
你好@a778h6 欢迎来到 stackoverflow。
针对您的疑问,您可以尝试以下步骤。我希望这能帮到您。
-Xfrozen_modules=off 标志用于在使用 Python 解释器时禁用模块冻结。但是,使用 VS Code 调试器时,它可能无法按预期工作。
如果即使在使用 launch.json 文件中的 args 或 pythonArgs 配置传递 -Xfrozen_modules=off 标志后仍然看到有关冻结模块的警告消息,您可以尝试以下操作:
确保在更改 launch.json 文件后已重新启动调试会话。
尝试将 -Xdev 标志添加到 launch.json 中的 pythonArgs 配置中。此标志用于禁用优化的 .pyc 文件的使用,这有时会在调试时导致问题。
如果您使用的是 VS Code 的 Python 扩展之类的扩展,请尝试更新到最新版本,以确保您拥有最新的错误修复和功能。
如果上述解决方案均不起作用,您可以尝试使用其他调试器,例如 pdb 或 ipdb,它们可能更适合调试使用冻结模块的代码。
请记住,冻结的模块是只读的,无法在运行时修改,因此您可能需要相应地调整调试方法。
归档时间: |
|
查看次数: |
5132 次 |
最近记录: |