在pycharm中编写程序,import调用模块时,有的模块下方会出现下划波浪线,提示Package containing module 'PIL' is not listed in the project requirements(或者提示Package containing module 'xxx' is not listed in the project requirements)。如图示:


或提示Unused import statement 'import matplotlib.pyplot as plt'。如图示:

此时只需在该python项目文件目录下requirements.txt中添加相对于模块即可,如图示:

![]()
原来的10 warnings,8 weak warnings,8 typos变为10 warnings,6 weak warnings,8 typos.下划线去除。

![]()
如有错误,还请指正,谢谢。
本文介绍了如何解决在PyCharm中编写程序时遇到的警告问题,例如模块未在项目需求中列出导致的下划波浪线提示及未使用的导入声明警告。通过在requirements.txt文件中添加缺失的模块名称,可以有效消除这些警告。

2646

被折叠的 条评论
为什么被折叠?



