1.首先打开 pycharm
2.点击左上角的File按钮
3.在弹出的菜单栏中,找到 Invalidate Caches/ Restart ...按钮,翻译成中文就是清除缓存
4.点击Invalidate这个按钮
for key in list(globals().keys()): if (not key.startswith("__")) and (key != "key"): globals().pop(key) print(key) del key 链接:https://www.zhihu.com/question/407406116/answer/1343971607