Pycharm python 调试器无法运行包含相对导入的文件

问题描述

我尝试将包含要调试的文件文件标记源根目录,但未成功。

[Pycharm 链接]https://intellij-support.jetbrains.com/hc/en-us/community/posts/360010615139-python-debugger-does-not-work-with-files-containing-relative-import

以下是我的调试配置:

enter image description here

我使用的是 Pycharm 2021.1(专业版

解决方法

您需要将工作目录下拉菜单更改为 .../pythonProject。现在您的工作目录是 timeserio/batches/chunked,其中没有 temeserio 包。