绕过配置文件,配置 jupyter noteook/lab 以支持远程访问

直接在command 中指定以下参数就可以启用远程访问

jupyter lab --allow-root --no-browser --notebook-dir=/root/stable-baselines --ip "*" --ServerApp.allow_remote_access=True 

备注:

1)--ip 是监听所有IP,本地的localhost 和其它IP

2) --ServerApp.allow_remote_access =True ,启用远程 

        其它:取消 token 和密码 :

        --ServerApp.token='' --ServerApp.password =''

3) 实际上,配置文件的全部配置项 都可以通过这方式在命令行参数中直接配置。注意去掉配置文件中的c. 。比如

以下提供了jupyter lab默认配置文件jupyter_lab_config.py,以便搜索使用命令行参数

# Configuration file for lab.

#------------------------------------------------------------------------------

# Application(SingletonConfigurable) configuration

#------------------------------------------------------------------------------

## This is an application.

## The date format used by logging formatters for %(asctime)s

#  Default: '%Y-%m-%d %H:%M:%S'

# c.Application.log_datefmt = '%Y-%m-%d %H:%M:%S'

## The Logging format template

#  Default: '[%(name)s]%(highlevel)s %(message)s'

# c.Application.log_format = '[%(name)s]%(highlevel)s %(message)s'

## Set the log level by value or name.

#  Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']

#  Default: 30

# c.Application.log_level = 30

## Instead of starting the Application, dump configuration to stdout

#  Default: False

# c.Application.show_config = False

## Instead of starting the Application, dump configuration to stdout (as JSON)

#  Default: False

# c.Application.show_config_json = False

#------------------------------------------------------------------------------

# JupyterApp(Application) configuration

#------------------------------------------------------------------------------

## Base class for Jupyter applications

## Answer yes to any prompts.

#  Default: False

# c.JupyterApp.answer_yes = False

## Full path of a config file.

#  Default: ''

# c.JupyterApp.config_file = ''

## Specify a config file to load.

#  Default: ''

# c.JupyterApp.config_file_name = ''

## Generate default config file.

#  Default: False

# c.JupyterApp.generate_config = False

## The date format used by logging formatters for %(asctime)s

#  See also: Application.log_datefmt

# c.JupyterApp.log_datefmt = '%Y-%m-%d %H:%M:%S'

## The Logging format template

#  See also: Application.log_format

# c.JupyterApp.log_format = '[%(name)s]%(highlevel)s %(message)s'

## Set the log level by value or name.

#  See also: Application.log_level

# c.JupyterApp.log_level = 30

## Instead of starting the Application, dump configuration to stdout

#  See also: Application.show_config

# c.JupyterApp.show_config = False

## Instead of starting the Application, dump configuration to stdout (as JSON)

#  See also: Application.show_config_json

# c.JupyterApp.show_config_json = False

#------------------------------------------------------------------------------

# ExtensionApp(JupyterApp) configuration

#------------------------------------------------------------------------------

## Base class for configurable Jupyter Server Extension Applications.

#

#      ExtensionApp subclasses can be initialized two ways:

#      1. Extension is listed as a jpserver_extension, and ServerApp calls

#          its load_jupyter_server_extension classmethod. This is the

#          classic way of loading a server extension.

#      2. Extension is launched directly by calling its `launch_instance`

#          class method. This method can be set as a entry_point in

#          the extensions setup.py

## Answer yes to any prompts.

#  See also: JupyterApp.answer_yes

# c.ExtensionApp.answer_yes = False

## Full path of a config file.

#  See also: JupyterApp.config_file

# c.ExtensionApp.config_file = ''

## Specify a config file to load.

#  See also: JupyterApp.config_file_name

# c.ExtensionApp.config_file_name = ''

#  Default: ''

# c.ExtensionApp.default_url = ''

## Generate default config file.

#  See also: JupyterApp.generate_config

# c.ExtensionApp.generate_config = False

## Handlers appended to the server.

#  Default: []

# c.ExtensionApp.handlers = []

## The date format used by logging formatters for %(asctime)s

#  See also: Application.log_datefmt

# c.ExtensionApp.log_datefmt = '%Y-%m-%d %H:%M:%S'

## The Logging format template

#  See also: Application.log_format

# c.ExtensionApp.log_format = '[%(name)s]%(highlevel)s %(message)s'

## Set the log level by value or name.

#  See also: Application.log_level

# c.ExtensionApp.log_level = 30

## Whether to open in a browser after starting.

#          The specific browser used is platform dependent and

#          determined by the python standard library `webbrowser`

#          module, unless it is overridden using the --browser

#          (ServerApp.browser) configuration option.

#  Default: False

# c.ExtensionApp.open_browser = False

## Settings that will passed to the server.

#  Default: {}

# c.ExtensionApp.settings = {}

## Instead of starting the Application, dump configuration to stdout

#  See also: Application.show_config

# c.ExtensionApp.show_config = False

## Instead of starting the Application, dump configuration to stdout (as JSON)

#  See also: Application.show_config_json

# c.ExtensionApp.show_config_json = False

## paths to search for serving static files.

#

#          This allows adding javascript/css to be available from the notebook server machine,

#          or overriding individual files in the IPython

#  Default: []

# c.ExtensionApp.static_paths = []

## Url where the static assets for the extension are served.

#  Default: ''

# c.ExtensionApp.static_url_prefix = ''

## Paths to search for serving jinja templates.

#

#          Can be used to override templates from notebook.templates.

#  Default: []

# c.ExtensionApp.template_paths = []

#------------------------------------------------------------------------------

# LabServerApp(ExtensionApp) configuration

#------------------------------------------------------------------------------

## A Lab Server Application that runs out-of-the-box

## "A list of comma-separated URIs to get the allowed extensions list

#

#  .. versionchanged:: 2.0.0

#      `LabServerApp.whitetlist_uris` renamed to `allowed_extensions_uris`

#  Default: ''

# c.LabServerApp.allowed_extensions_uris = ''

## Answer yes to any prompts.

#  See also: JupyterApp.answer_yes

# c.LabServerApp.answer_yes = False

## The application settings directory.

#  Default: ''

# c.LabServerApp.app_settings_dir = ''

## The url path for the application.

#  Default: '/lab'

# c.LabServerApp.app_url = '/lab'

## Deprecated, use `LabServerApp.blocked_extensions_uris`

#  Default: ''

# c.LabServerApp.blacklist_uris = ''

## A list of comma-separated URIs to get the blocked extensions list

#

#  .. versionchanged:: 2.0.0

#      `LabServerApp.blacklist_uris` renamed to `blocked_extensions_uris`

#  Default: ''

# c.LabServerApp.blocked_extensions_uris = ''

## Whether to cache files on the server. This should be `True` except in dev

#  mode.

#  Default: True

# c.LabServerApp.cache_files = True

## Full path of a config file.

#  See also: JupyterApp.config_file

# c.LabServerApp.config_file = ''

## Specify a config file to load.

#  See also: JupyterApp.config_file_name

# c.LabServerApp.config_file_name = ''

##

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值