ipython
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 | ||
ipython [2016/08/19 03:07] – 만듦 rex8312 | ipython [2024/03/23 02:38] (현재) – 바깥 편집 127.0.0.1 | ||
---|---|---|---|
줄 1: | 줄 1: | ||
====== IPython ====== | ====== IPython ====== | ||
- | ===== ipython notebook 기본 | + | ===== Autoreload ===== |
+ | |||
+ | %load_ext autoreload | ||
+ | %autoreload 2 | ||
+ | |||
+ | ===== ipython notebook 기본 | ||
변경을 원하는 profile의 ipython_notebook_config.py 수정(없으면 생성) | 변경을 원하는 profile의 ipython_notebook_config.py 수정(없으면 생성) | ||
줄 7: | 줄 12: | ||
<code python ipython_notebook_config.py> | <code python ipython_notebook_config.py> | ||
- | # sample ipython_config.py | ||
c = get_config() | c = get_config() | ||
- | # Subset of matplotlib rcParams that should be different for the inline backend. | + | # 외부에서 노트북 접속가능 |
+ | c.NotebookApp.ip = ' | ||
+ | |||
+ | # 기본 figure size 설정 | ||
c.InlineBackend.rc = {' | c.InlineBackend.rc = {' | ||
+ | </ | ||
+ | |||
+ | ===== IPython Interpreter Embed 하기 ===== | ||
+ | |||
+ | <code python> | ||
+ | from IPython import embed | ||
+ | embed() | ||
+ | </ | ||
+ | |||
+ | 예외가 발생하거나 사용자가 프로그램 실행 도중에 개입하고 싶을때 사용예 | ||
+ | |||
+ | <code python> | ||
+ | from IPython import embed | ||
+ | import traceback | ||
+ | |||
+ | ... | ||
+ | while True: | ||
+ | try: | ||
+ | do_something() | ||
+ | except KeyboardInterrupt: | ||
+ | embed() | ||
+ | except Exception as e: | ||
+ | traceback.print_exc() | ||
+ | embed() | ||
+ | |||
+ | ... | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===== asyncio와 같이 사용 ===== | ||
+ | |||
+ | <code python> | ||
+ | %autoawait True | ||
</ | </ |
ipython.1471576069.txt.gz · 마지막으로 수정됨: 2024/03/23 02:37 (바깥 편집)