解决python cannot find reference xxx in imported module xxx
第一种:File
→ Settings
→ Editor
→ File Types
→ Ignore files and folders
,去掉框框中的:init.py;,然后:OK等待重新文件扫描。
第二种:File
→ Invalidate Caches / Restart
,选择Invalidate and Restart
,等待重新扫描库文件就好了。
其他方式:
PyCharm
-> File
-> Settings
-> Build,Excution,Deployment
-> Console
-> Python Console
然后在 Add sources roots to PYTHONPATH
旁边打勾
PyCharm
-> File
-> Settings
-> Project(Project : pythonProject)
-> Project Structure
然后选中文件夹右键把Sources
选上
如果仍然存在问题
例如torch_ecg.torch_ecg.错误。这个问题就得看看你这个文件在不在了。重新下载该文件导入即可