double click to open an ipython notebook

2019-03-14 17:38发布

问题:

Related posts: Open an ipython notebook via double-click on osx

How can I open Ipython notebook from double click? I always cd to the directory of the notebook, then type ipython notebook in the browser and then open it in the browser. This steps is very inconvenient.

In windows, I remembered that I can change the directory in the browser, but in linux there is no way to explore to other directory via browser, if I want to open a new book in another directory, I have to restart another kernel as above, which annoys me.

Is there any simple and verified way to do this?

回答1:

You can use a project like nbopen that handle that and will open the browser on the right notebook + start an IPython server if one is not yet running.



回答2:

  1. pip install (nbopen).
  2. open Automator, create new Application - Add Run Shell Script (/bin/bash), Change Pass Input 'as arguments' - use this script:

    #!/bin/sh variable="'$1'" the_script='tell application "terminal" to do script "nbopen ' osascript -e "${the_script}${variable}\""

    1. copy the new application to "/Applications" directory
    2. goto any ipynb file and select the new app to open.