从系统默认值更改IPython Notebook的浏览器 [英] Changing browser for IPython Notebook from system default

查看:110
本文介绍了从系统默认值更改IPython Notebook的浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将firefox保留为Mac上的系统默认浏览器,但要在Chrome [1] 中启动IPython Notebook.

I would like to keep firefox as my system default browser on my Mac, but launch IPython Notebook in Chrome[1].

此答案使我进入了我的ipython_notebook_config.py文件,但我无法运行Chrome实例.在c = get_config()import webbrowser之后,我尝试了:

This answer led me to my ipython_notebook_config.py file but I can't get an instance of Chrome running. After c = get_config() and import webbrowser, I've tried:

  1. webbrowser.register(u'chrome', None, webbrowser.Chrome())

webbrowser.register(u'chrome', webbrowser.Chrome)

webbrowser.register(u'chrome', None, webbrowser.GenericBrowser('/Applications/Browsers/Chrome.app'))

webbrowser.register(u'chrome', None, webbrowser.GenericBrowser('/Applications/Browsers/Chrome.app/Contents/MacOS/Google\ Chrome'))

全部后跟c.NotebookApp.browser = u'chrome'

我在解释器中弄弄了webbbrowser,却不知道如何创建Chrome实例.

I've fiddled with webbbrowser in the interpreter, and couldn't figure out how to create an instance of Chrome.

[1]:PS为什么在Firefox中IPython Notebook 这么慢,特别是对于带有内联后端的pylab?在chrome中,速度快了几个数量级(用于渲染,滚动等).

[1]: PS Why is IPython Notebook so slow in firefox, especially for pylab with the inline backend? It's orders of magnitude faster (for rendering, scrolling, etc) in chrome.

推荐答案

自从极大地切换到Jupyter以来,并且使用了OS X的最新版本(例如Yosemite),Jupyter/iPython(例如4.0.1)和Chrome (例如47岁),情况有所变化. Jupyter/iPython不再将笔记本配置文件放在~/.ipython中;现在位于~/.jupyter中,并且默认文件是使用

Since the great switch to Jupyter, and with recent versions of OS X (e.g., Yosemite), Jupyter/iPython (e.g., 4.0.1), and Chrome (e.g., 47), things have changed a bit. Jupyter/iPython no longer puts the notebook config file in ~/.ipython; it's now in ~/.jupyter, and the default file is generated with

jupyter notebook --generate-config

如果您有现有的ipython_notebook_config.py,则可以使用jupyter migrate进行迁移( H/T ).

If you have an existing ipython_notebook_config.py you can migrate it with jupyter migrate (H/T).

生成或迁移配置文件后,将以下行添加到jupyter_notebook_config.py:

After generating or migrating your config file, add the following line to jupyter_notebook_config.py:

c.NotebookApp.browser = u'/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %s'

这篇关于从系统默认值更改IPython Notebook的浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆