gpt4 book ai didi

python - 调试时找不到模块

转载 作者:行者123 更新时间:2023-12-04 12:26:21 26 4
gpt4 key购买 nike

我正在使用 PyCharm 运行 Python 客户端。如果我直接运行它,PyCharm 只需调用:

C:\Python27\python.exe E:/faf/client/src

一切都很好。

这些是我的设置:

enter image description here

如果我想调试它,PyCharm 调用:
C:\Python27\python.exe "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 5.0.2\helpers\pydev\pydevd.py" --multiproc --qt-support --client 127.0.0.1 --port 52948 --file E:/faf/client/src

结果是无法包含实际上存在的模块
pydev debugger: process 5092 is connecting

Connected to pydev debugger (build 143.1184)
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 5.0.2\helpers\pydev\pydevd.py", line 2407, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 5.0.2\helpers\pydev\pydevd.py", line 1798, in run
launch(file, globals, locals) # execute the script
File "E:/faf/client/src\__main__.py", line 29, in <module>
import config
ImportError: No module named config

我该怎么做才能调试这个东西?

最佳答案

我不得不点击 src目录并将其添加为源文件夹( Mark Directory As -> Source Root )。没有明显的变化,例如python 命令被调用的方式。

因此,如果您有类似的问题,请尝试执行相同的操作。

关于python - 调试时找不到模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34383281/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com