매번 라이브러리나 모듈을 수정하면 jupyter에서는 import 된 상태로 그대로 있기 때문에 jupyter kernel 을 재시작해줘야하거나 별도로 reload를 해야한다.
매직라인으로 자동 리로드 할 수 있다.
%load_ext autoreload
%autoreload all
이렇게만 써놓으면 자동으로 항상 reload 한다
%autoreload now: 현재 시점에서 재로드
%autoreload off: 끔
%autoreload explicit: %aimport가 있는 경우에만 재로드
%autoreload all: 항상 리로드
노트북 환경이랑 일반환경을 번갈아가면서 쓸 때에는.. 아래처럼
from IPython import get_ipython
if get_ipython():
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', 'all')
'IT > Python' 카테고리의 다른 글
[Matplotlib] vline, hline 두께 조절 (0) | 2024.05.01 |
---|---|
[Matplotlib] 그래프에서 특정 축만 안보이게 하기 (0) | 2024.04.30 |
[Matplotlib] AttributeError: 'Axes' object has no attribute 'get_zticklabels' (1) | 2024.04.26 |
[Matplotlib] findfont: Font family 'Arial' not found. (0) | 2024.04.25 |
[VS Code] Python 코딩 관련 팁 (0) | 2024.03.27 |