使用特定(非默认)firefox配置文件启动ipython笔记本电脑
当我启动使用特定(非默认)firefox配置文件启动ipython笔记本电脑,ipython,ipython-notebook,Ipython,Ipython Notebook,当我启动ipython notebook时,我希望它启动firefox,但使用特定的firefox配置文件,这不是我的默认firefox配置文件 在我的ipython档案中,我有 c.NotebookApp.browser = u'/usr/bin/firefox' 这就确保了ipython笔记本电脑选择firefox。但是,它选择默认的firefox配置文件,或者选择最近使用的firefox配置文件 从我的linux终端,我可以像这样启动我首选的ipython特定firefox配置文件(名为
ipython notebook
时,我希望它启动firefox,但使用特定的firefox配置文件,这不是我的默认firefox配置文件
在我的ipython
档案中,我有
c.NotebookApp.browser = u'/usr/bin/firefox'
这就确保了ipython笔记本电脑选择firefox。但是,它选择默认的firefox配置文件,或者选择最近使用的firefox配置文件
从我的linux终端,我可以像这样启动我首选的ipython
特定firefox配置文件(名为ipython
)
firefox -P --no-remote ipython
但是,
c.NotebookApp.browser = u'/usr/bin/firefox -P --no-remote ipython'
根本不起作用(ipython根本不会打开firefox
,并且会跳转到另一个浏览器),启动ipython笔记本也不会像这样
ipython notebook --browser 'firefox -P --no-remote ipython'
这将导致和OSError
异常
有人知道用首选配置启动firefox的方法吗?有点难看,但可能比什么都没有要好。我将以下内容放入一个shell脚本中,以分别启动firefox和ipython,但同时启动
firefox -P ipython -no-remote
ipython notebook --no-browser
您需要刷新浏览器。我的解决方案使用脚本以请求的配置文件启动firefox,并让Jupyter调用它
在例如/usr/local/bin/firefox notebook
中创建包含以下内容的脚本:
!/bin/env sh
firefox -P notebook $@
通过在Jupyter\u notebook\u config.py
中添加以下内容,指示Jupyter将该脚本用作浏览器:
import webbrowser
browser = webbrowser.Mozilla('firefox-notebook')
webbrowser.register('firefox-notebook', None, browser)
c.NotebookApp.browser = 'firefox-notebook'
您只需将c.NotebookApp.browser='firefox-p notebook--new window%s'
添加到~/.jupyter/jupyter\u notebook\u config.py
。(您错过了%s
。它将被提供jupyter的URL替换。)