说,我的项目结构如下:
project_folder:
__init__.py
another_folder:
__init__.py
main_file.py
other_file.py
并main_file.py
包含下一个代码:
import other_file as whatever
PyCharm(PEP8)将此行突出显示为错误“ no module named other_file
”,并且在诸如之类的任何调用上均不会自动完成whatever.this_should_be_autoc_suggested
。同时,口译员也能很好地工作。
造成这种令人讨厌的行为的原因是什么?
您需要将项目目录标记为“ Sources Root”,只需右键单击pycharm中的目录,将Directory标记为Sources Root。那应该可以帮到您。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句