2023년 1월 4일 수요일

Jupyter Qtconsole 설치 및 사용 팁 몇가지

 0. 설치

miniconda가 설치된 환경에서 터미널을 열고

% conda create -n jupyter

% conda activate jupyter

(jupyter)% conda install qtconsole

(jupyter)% jupyter qtconsole

위의 명령어를 순서되로 치면 jupyter라는 가상환경을 만들고, 그곳으로 들어가서,  jupyter가 qtconsole 환경에서 실행된다.( ipython 사용법은 이곳 참조 )

1. 가장기본적인 키 Enter가 3가지입니다. 그냥 엔터키는 현재 셀을 실행, 컨트롤 + 엔터는 줄바꿈만  일어납니다. 쉬프트 + 엔터는 셀 실행. ESC 키는 셀에서 빠져나오기.

2. 업키는 이전 셀(히스토리)을 불러옵니다. 

   홈키를 눌러 맨압으로 이동. 

   %%writefile + 파일명 + 엔터한후 쉬프트+엔터하면 파일로 저장됩니다.

   %은 magic키로 여러 종류가 있으니 %magic하여 살펴보세요.

    cat, cp, mv, rm, rmdir, mkdir, ls, echo, cd, clear, conda, pip, reset

3. 환경설정

(jupyter)% jupyter qtconsole --help-all 하면 관련 옵션을 볼 수 있으며

(jupyter)% jupyter qtconsole --generate-config 하면 환경을 새로 생성합니다.

(jupyter)% jupyter qtconsole 한후

In [6] load ~/.jupyter/jupyter_qtconsole_config.py

편집기로 불러 아래와 같이 콘솔의 가로 크기와 폰트 크기를 키워줌

%edit exam01.py 하면 VSCode 에서 편집할 수 있도록 아래와 같이 수정함.

c.JupyterWidget.editor = 'code'

c.ConsoleWidget.console_width = 121
# c.ConsoleWidget.font_family = ''
## The font size. If unconfigured, Qt will be entrusted
# with the size of the font.
# Default: 0
c.ConsoleWidget.font_size = 14

저장은 아래와 같이 한 후 쉬프트+엔터 하면됩니다.


가로크기와 폰트가 커졌음을 확인합니다.

외부파일 편집은 %edit ~/.jupyter/jupyter_qtconsole_config.py 형식으로 하면됩니다.


댓글 없음:

tensorflow gpu 사용하기에서

 tensorflow 설치시 주의해야 한다. # Anything above 2.10 is not supported on the GPU on Windows Native python - m pip install "tensorflow<2.11...