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