[PYTHON] Specify the browser to use with Jupyter Notebook. Especially Mac. (And Vivaldi)

Introduction

How to start Jupyter notebook in any browser instead of the one specified as the browser you normally use. Linux and Windows are basically the same, but on Mac they are ** slightly ** different. _ (2018/6/18) Vivaldi is also a little different, so I added it. _

environment

procedure

1. 1. Jupyter configuration file creation

Execute the following command in the terminal.

$ jupyter notebook --generate-config

Writing default config to: /Users/(user_name)/.jupyter/jupyter_notebook_config.py

This will create the following files: (It will tell you when you execute the above command properly)

~/.jupyter/jupyter_notebook_config.py

2. Specify the browser in the configuration file

Open the above file with a text editor and look for the following items.

jupyter_notebook_config.py


# c.NotebookApp.browser = ''

Uncomment and change as follows:

jupyter_notebook_config.py


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

If you add the option --new-window after% s, it will start in a new window.

important point

-** It seems that it is necessary to specify with a startup option on Mac **, so it is not enough to specify the application path like /Applications/Firefox.app. On Linux and Windows, the path of the browser executable file itself is fine. _ (Added on 2018/6/18) _ ** It doesn't seem to be a Mac-specific difference ** Even on Ubuntu, ** Vivaldi ** required % s. We have not investigated the details of the specifications. I don't know. --On Mac, in Chrome, there is a space in the application name, so escape the space with `\`. --Since the configuration file is a Python script, you may have to add 'u' to the beginning of the browser path in the Python2 environment.

u'Applications/Google\ Chrome.app/・ ・ ・'



### reference
 Click here for a Python script that handles the above settings.
/Users/(user_name)/.pyenv/versions/anacondaX-X.X.X/lib/pythonX.X/webbrowser.py

 My environment is pyenv, but please read it as your own environment.
```--new-window```You can see that there are options such as.


Recommended Posts

Specify the browser to use with Jupyter Notebook. Especially Mac. (And Vivaldi)
Use Jupyter Lab and Jupyter Notebook with EC2
How to use jupyter notebook with ABCI
Specify the Python executable to use with virtualenv
Fill the browser with the width of Jupyter Notebook
Specify MinGW as the compiler to use with Python
Use pip with Jupyter Notebook
Use Cython with Jupyter Notebook
How to use Jupyter Notebook
I want to use a virtual environment with jupyter notebook!
The usual way to add a Kernel with Jupyter Notebook
Connect the Jupyter Notebook kernel to Spyder with Jupytext enabled
Use markdown with jupyter notebook (with shortcut)
Easy to use Jupyter notebook (Python3.5)
How to run Jupyter and Spark on Mac with minimal settings
How to use jupyter notebook without polluting your environment with Docker
Install Anaconda on Mac and upload Jupyter (IPython) notebook to Anaconda Cloud
The strongest way to use MeCab and CaboCha with Google Colab
Use nb extensions with Anaconda's Jupyter notebook
Use apache Spark with jupyter notebook (IPython notebook)
I want to blog with Jupyter Notebook
Linking python and JavaScript with jupyter notebook
Jupyter Notebook Basics of how to use
How to use Jupyter notebook [Super Basic]
I wanted to use jupyter notebook with docker in pip environment (opticspy)
How to get started with the 2020 Python project (windows wsl and mac standardization)
How to specify the launch browser for JupyterLab 3.0.0
How to debug with Jupyter or iPython Notebook
What to do if the latest Jupyter Notebook and nb extensions don't work
Launch and use IPython notebook on the network
To output a value even in the middle of a cell with Jupyter Notebook
Specify the start and end positions of files to be included with qiitap
The easiest way to use OpenCV with python
Install and set Jupyter Notebook to create a study note creation environment [Mac]
Jupyter Notebook Settings-How to use (EC2 Amazon Linux 2)
Add / remove kernel to use jupyter with venv
Use ipywidgets in jupyter notebook to interactively manipulate parameters and also try image processing
Read the csv file with jupyter notebook and write the graph on top of it
Monitor the training model with TensorBord on Jupyter Notebook
[Python] How to specify the download location with youtube-dl
Mac application for double-clicking to open Jupyter Notebook (* .ipynb)
How to use the grep command and frequent samples
How to instantly launch Jupyter Notebook from the terminal
Next to Excel, for the time being, jupyter notebook
How to use argparse and the difference between optparse
Try to specify the axis with PyTorch's Softmax function
Use nim with Jupyter
Use Python to monitor Windows and Mac and collect information on the apps you are working on
How to deal with the phenomenon that Python (Jupyter notebook) executed on WSL becomes Aborted
Playing with LEGO and breaking into the 3D industry-The ultimate goal is to use Unity-
Easy to use Nifty Cloud API with botocore and python
I want to use R functions easily with ipython notebook
Memo to get the value on the html-javascript side with jupyter
[pyqtgraph] Add region to the graph and link it with the graph region
Reflect the virtual environment created with Miniconda in Jupyter notebook
[Python] I want to use the -h option with argparse
"Deep copy" and "Shallow copy" to understand with the smallest example
How to see the contents of the Jupyter notebook ipynb file
Read the VTK file and display the color map with jupyter.
[Introduction to Mac] Convenient Mac apps and settings that I use
How to touch Jupyter Notebook without polluting the environment other than Pythonista, or how to touch Ruby with Jupyter Notebook without polluting the environment other than Rubyist