调试时找不到模块

时间:2015-12-20 16:42:56

标签: python pycharm

我正在使用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

我需要做些什么来调试这个东西?

1 个答案:

答案 0 :(得分:0)

我为自己解决了此问题,方法是在我要导入的模块的文件夹中添加一个 init .py。