簡體   English   中英

我可以恢復我在 Jupyter 筆記本中錯誤刪除的 python function 嗎?

[英]Can I recover a python function I mistakenly deleted in a Jupyter notebook?

I imported matplotlib.pyplot as plt , then mistakenly defined a variable with the the function matplotlib.pyplot.xticks function name (ie plt.xticks =... instead of plt.xticks(...) ) in a Jupyter notebook. 然后我嘗試使用del plt.xticks撤消定義,它刪除了變量,還刪除了 function。 我嘗試重新導入 matplotlib,但 plt.xticks 仍然不存在:

plt.xticks

AttributeError: module 'matplotlib.pyplot' has no attribute 'xticks'

在其他筆記本中,即使重新導入庫后,該命令也有效。 在這個特定的筆記本中,我可以通過import matplotlib來解決這個問題。 還有其他方法嗎?

我曾經做過同樣的事情,重新啟動 kernel 就成功了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM