on
Python 개발을 편하게 iPython
Python 개발을 편하게 iPython
반응형
서버를 두고 원격으로 python 으로 AI 관련 개발을 하다보면
중간중간 확인과정을 거쳐야 하는데, 이미지나 그래프등 바로 바로 확인이 안된다.
plt.show() 나 cv.imshow() 등등..
이미지를 저장해서 확인하지 않은이상 쉽지 않다
이럴때, 구글 코랩과 같은 대화형 쉘을 이용하면 편리하게 개발을 할수 있다.
대화형 쉘을 지원하는 iPython 을 설치하면 개발이 편리해진다.
설치 방법과 운용이 너무 간단하다.
설치는 아래 명령어 한줄이면 된다.
pip install jupyterlab
실행은 아래와 같이 한줄이면 된다.
jupyter lab --ip=0.0.0.0
뒤에 --ip 옵션은 외부에서 접속할수 있도록 Listen IP 를 0.0.0.0 으로 설정한것이다.
jupyter lab --help 명령어를 입력하면 옵션을 확인할수 있다.
JupyterLab - An extensible computational environment for Jupyter. This launches a Tornado based HTML Server that serves up an HTML5/Javascript JupyterLab client. JupyterLab has three different modes of running: * Core mode (`--core-mode`): in this mode JupyterLab will run using the JavaScript assets contained in the installed `jupyterlab` Python package. In core mode, no extensions are enabled. This is the default in a stable JupyterLab release if you have no extensions installed. * Dev mode (`--dev-mode`): uses the unpublished local JavaScript packages in the `dev_mode` folder. In this case JupyterLab will show a red stripe at the top of the page. It can only be used if JupyterLab is installed as `pip install -e .`. * App mode: JupyterLab allows multiple JupyterLab "applications" to be created by the user with different combinations of extensions. The `--app-dir` can be used to set a directory for different applications. The default application path can be found using `jupyter lab path`. Subcommands =========== Subcommands are launched as `lab cmd [args]`. For information on using subcommand 'cmd', do: `lab cmd -h`. build clean path paths workspace workspaces licenses Options ======= The options below are convenience aliases to configurable class-options, as listed in the "Equivalent to" description-line of the aliases. To see all configurable class-options for some , use: --help-all --debug Set debug level for the extension and underlying server applications. Equivalent to: [--ServerApp.log_level=DEBUG --ExtensionApp.log_level=DEBUG] --generate-config generate default config file Equivalent to: [--JupyterApp.generate_config=True] -y Answer yes to any questions instead of prompting. Equivalent to: [--JupyterApp.answer_yes=True] --allow-root Allow the server to be run from root user. Equivalent to: [--ServerApp.allow_root=True] --no-browser Prevent the opening of the default url in the browser. Equivalent to: [--ServerApp.open_browser=False --ExtensionApp.open_browser=False] --autoreload Autoreload the webapp Enable reloading of the tornado webapp and all imported Python packages when any changes are made to any Python src files in server or extensions. Equivalent to: [--ServerApp.autoreload=True] --script DEPRECATED, IGNORED Equivalent to: [--FileContentsManager.save_script=True] --no-script DEPRECATED, IGNORED Equivalent to: [--FileContentsManager.save_script=False] --core-mode Start the app in core mode. Equivalent to: [--LabApp.core_mode=True] --dev-mode Start the app in dev mode for running from source. Equivalent to: [--LabApp.dev_mode=True] --watch Start the app in watch mode. Equivalent to: [--LabApp.watch=True] --splice-source Splice source packages into app directory. Equivalent to: [--LabApp.splice_source=True] --expose-app-in-browser Expose the global app instance to browser via window.jupyterlab. Equivalent to: [--LabApp.expose_app_in_browser=True] --extensions-in-dev-mode Load prebuilt extensions in dev-mode. Equivalent to: [--LabApp.extensions_in_dev_mode=True] --collaborative Whether to enable collaborative mode. Equivalent to: [--LabApp.collaborative=True] --log-level= Set the log level by value or name. Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'] Default: 30 Equivalent to: [--Application.log_level] --config= Full path of a config file. Default: '' Equivalent to: [--JupyterApp.config_file] --ip= The IP address the Jupyter server will listen on. Default: 'localhost' Equivalent to: [--ServerApp.ip] --port= The port the server will listen on (env: JUPYTER_PORT). Default: 0 Equivalent to: [--ServerApp.port] --port-retries= The number of additional ports to try if the specified port is not available (env: JUPYTER_PORT_RETRIES). Default: 50 Equivalent to: [--ServerApp.port_retries] --keyfile= The full path to a private key file for usage with SSL/TLS. Default: '' Equivalent to: [--ServerApp.keyfile] --certfile= The full path to an SSL/TLS certificate file. Default: '' Equivalent to: [--ServerApp.certfile] --client-ca= The full path to a certificate authority certificate for SSL/TLS client authentication. Default: '' Equivalent to: [--ServerApp.client_ca] --notebook-dir= The directory to use for notebooks and kernels. Default: '' Equivalent to: [--ServerApp.root_dir] --browser= Specify what command to use to invoke a web browser when starting the server. If not specified, the default browser will be determined by the `webbrowser` standard library module, which allows setting of the BROWSER environment variable to override it. Default: '' Equivalent to: [--ServerApp.browser] --pylab= DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib. Default: 'disabled' Equivalent to: [--ServerApp.pylab] --watch= Whether to serve the app in watch mode Default: False Equivalent to: [--LabApp.watch] --app-dir= The app directory to launch JupyterLab from. Default: None Equivalent to: [--LabApp.app_dir] Examples -------- jupyter lab # start JupyterLab jupyter lab --dev-mode # start JupyterLab in development mode, with no extensions jupyter lab --core-mode # start JupyterLab in core mode, with no extensions jupyter lab --app-dir=~/myjupyterlabapp # start JupyterLab with a particular set of extensions jupyter lab --certfile=mycert.pem # use SSL/TLS certificate To see all available configurables, use `--help-all`.
실행시 접속할수 있는 주소와 토큰을 주는데, 이때 패스워드를 변경하면 앞으로 실행시 토큰없이 해당 패스워드로 접속이 가능하다.
미리 알았더라면 개발을 수월하게 했을텐데, 지금이라도 알아서 참 다행이다 ㅠ
기본 코드 작성은 inteliJ 를 이용하고 실행하고 확인하는 과정이 필요할때 이용하고 있다.
끝!
반응형
from http://brtech.tistory.com/144 by ccl(A) rewrite - 2021-09-17 18:01:59