Spyder 运行出现 Reloaded modules: **AttributeError: 'NoneType' object has no attribute 'modules' 错误的解决方法

问题描述:
刚开始学习python,有很多问题不懂,网上找了很久找不到答案,就把这个问题记下来,希望可以帮助到其他初学者
使用spyder运行以下代码:
Spyder 运行出现 Reloaded modules: **AttributeError: 'NoneType' object has no attribute 'modules' 错误的解决方法
第一次运行可以正常显示结果,第二次运行时报错:
Reloaded modules: ***************************
***************************************************
AttributeError: ‘NoneType’ object has no attribute ‘modules’

出现这个错误网上找了好久没有查到解决方法,去查看spyder文档发现关于“Using UMR to reload changed modules”的内容,查到以下解决方法:
点击菜单栏Tools->Preferences->Python interpreter->User Module Reloader (UMR),将Enable UMR的选项取消,重新启动spyder,问题解决

Spyder 运行出现 Reloaded modules: **AttributeError: 'NoneType' object has no attribute 'modules' 错误的解决方法

修改后重新启动spyder,多次点击运行也不会报错了
Spyder 运行出现 Reloaded modules: **AttributeError: 'NoneType' object has no attribute 'modules' 错误的解决方法