Anaconda's Jupyter Notebook replaces the default browser

Because the previously installed Anaconda uses the Edge browser that comes with the system by default: (yes, this is the thing)

Then I have been using win11 recently, the previous versions did not have any major problems, but the system was automatically updated around the 20th, and this is right. Then the Microsoft Edge browser couldn’t be opened directly . I searched for the reason for a long time and found that everyone had a common phenomenon. It is probably a bug in the win11 system. Microsoft’s official statement was to downgrade the version, but it was too troublesome.

        But I am anxious to use this Jupyter Notebook, what should I do, just find out how to switch the default browser of Jupyter Notebook. Here's how: 

text:

Everyone opens Anaconda, and then opens Prompt, as shown below

Enter jupyter notebook --generate-config in it

 According to the path drawn in red above, (too lazy to open the file step by step, you can directly copy the path and paste it into the file manager,) find the file jupyter_notebook_config.py, and open it with Notepad or other editors.

 

 After opening, you can directly press Ctr+F to find NotebookApp.browser, as shown in the figure, add the following code directly behind:

 

import webbrowser
webbrowser.register("chrome",None,webbrowser.GenericBrowser(u"C:\Program Files (x86)\Google\Chrome\Application\\chrome.exe"))
c.NotebookApp.browser = 'chrome'

After adding, press save to close, restart Anaconda, open Jupyter Notebook, and that's it.

! ! ! Pay attention to the path marked in red in webbrowser.register("chrome",None,webbrowser.GenericBrowser(u" C:\Program Files (x86)\Google\Chrome\Application\\chrome.exe ")), according to your own To copy it according to the actual situation, you can first find out whether the corresponding chrome.exe file is in the directory according to the path. If it is, it is safest to directly copy the path in the file manager. Don't just copy me.

The same applies to other browsers.

Guess you like

Origin blog.csdn.net/fan18317517352/article/details/123079222