ask*_*han 17 browser macos ipython ipython-notebook
我想在我的Mac上保留firefox作为我的系统默认浏览器,但是在Chrome [1]中启动IPython Notebook .
这个答案让我得到了我的ipython_notebook_config.py文件,但我无法获得Chrome运行的实例.后c = get_config()和import webbrowser,我已经试过:
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实例.
[1]:PS为什么IPython Notebook 在firefox中这么慢,特别是对于内联后端的pylab?它在chrome中的速度要快一些(渲染,滚动等).
Dan*_*Dan 14
自从改用Jupyter以及最新版本的OS X(例如优胜美地),Jupyter/iPython(例如4.0.1)和Chrome(例如47)之后,情况发生了一些变化.Jupyter/iPython不再放入笔记本配置文件~/.ipython; 它现在在~/.jupyter,并生成默认文件
jupyter notebook --generate-config
Run Code Online (Sandbox Code Playgroud)
如果您有现有的ipython_notebook_config.py,可以使用jupyter migrate(H/T)进行迁移.
生成或迁移配置文件后,将以下行添加到jupyter_notebook_config.py:
c.NotebookApp.browser = u'/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %s'
Run Code Online (Sandbox Code Playgroud)
小智 12
基于这个答案,(运行的Python 2.7.3和IPython的-0.13.1在Linux上),我不得不在我的设置ipython_notebook_config.py是
c.NotebookApp.browser = u'/usr/bin/google-chrome %s'
Run Code Online (Sandbox Code Playgroud)
我猜,设置c.NotebookApp.browser到/Applications/Browsers/Chrome.app/Contents/MacOS/Google Chrome %s应该为你工作.
在OS X上,您可以将以下内容放在ipython_notebook_config.py中以打开Chrome:
c.NotebookApp.browser = u'/usr/bin/open -a Google\\ Chrome %s'
Run Code Online (Sandbox Code Playgroud)
"/ Applications/Google Chrome.app/Contents/MacOS/Google Chrome"中的可执行文件因"无法获取配置文件锁定"而失败,因此通过"打开"是我看到的唯一简单替代方案.
这可能不是正确的事情,但是
$ open -a Google\ Chrome http://localhost:8888
$ open -a Firefox http://localhost:8888
Run Code Online (Sandbox Code Playgroud)
从我这里工作(仅限于mac),在2个浏览器中的任何一个中打开任何URL.
使用该--no-browser选项并创建一个执行该操作的bash函数.或者甚至在Chrome中有书签.
对于想要将 Firefox 设置为 ipython 笔记本默认设置(不一定是系统默认设置)的人,添加以下行应该就ipython_notebook_config.py足够了:
c.NotebookApp.browser = 'Firefox'
对我来说,这比直接链接到应用程序文件更好,因为它避免了错误:A copy of Firefox is already open. Only one copy of Firefox can be open at a time.
| 归档时间: |
|
| 查看次数: |
16866 次 |
| 最近记录: |