jupyter安装配置(Virtualbox运行)

python3 -m pip install --upgrade pip

python3 -m pip install jupyter

运行:
jupyter notebook

如果jupyter是运行在virtualbox虚拟机里面,那么可以设置virtualbox允许主机访问:
由于virtualbox设置成了NAT网络连接,因此需要通过端口转发的方式,允许宿主机器访问。
jupyter server的默认端口是8888,可以在virtualbox上设置端口转发如下:

设置完以后最好重启一下virtualbox,保证生效。这样在宿主机可以通过http://127.0.0.1:9090 访问

另外,jupyter可以按如下方式配置:
如果还没有配置文件,可以通过jupyter notebook --generate-config 生成.jupyter目录,里面会生成jupyter_notebook_config.py,
可以定制自己需要的配置,例如:

#  Local IP addresses (such as 127.0.0.1 and ::1) are allowed as local, along
#  with hostnames configured in local_hostnames.
c.NotebookApp.allow_remote_access = True

## The IP address the notebook server will listen on.
(0.0.0.0即监听所有网卡IP)
c.NotebookApp.ip = '0.0.0.0'

## The directory to use for notebooks and kernels.(设置工作目录)
c.NotebookApp.notebook_dir = '/home/xxx/jupyter'

## 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 (NotebookApp.browser)
#  configuration option.
c.NotebookApp.open_browser = False

## Token used for authenticating first-time connections to the server.
#  
#  When no password is enabled, the default is to generate a new, random token.
#  
#  Setting to an empty string disables authentication altogether, which is NOT
#  RECOMMENDED.
#c.NotebookApp.token = '<generated>'
c.NotebookApp.token = ''

 

常用快捷键:

Command Mode

  • shift + enter run cell, select below
  • ctrl + enter run cell
  • option + enter run cell, insert below
  • A insert cell above
  • B insert cell below
  • C copy cell
  • V paste cell
  • D , D delete selected cell
  • shift + M merge selected cells, or current cell with cell below if only one cell selected
  • I , I interrupt kernel
  • 0 , 0 restart kernel (with dialog)
  • Y change cell to code mode
  • M change cell to markdown mode (good for documentation)

Edit Mode

  • cmd + click for multi-cursor editing
  • option + scrolling click for column editing
  • cmd + / toggle comment lines
  • tab code completion or indent
  • shift + tab tooltip
  • ctrl + shift + - split cell

参考:
http://jupyter.org/install.html
https://jupyter-notebook.readthedocs.io/en/latest/public_server.html#notebook-public-server

http://maxmelnick.com/2016/04/19/python-beginner-tips-and-tricks.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值