while coding a Python-based AI when we are to access the internet through it. The Default web browser opens is Internet Explorer. How to get chrome as default?
- It would help if you provided at least a sample of the code used for opening the browser.matszwecja– matszwecja2021-08-31 07:20:21 +00:00Commented Aug 31, 2021 at 7:20
- I think changing your default browser on your OS should fix this. If you're using anaconda/jupyter, use this.Noufal Ibrahim– Noufal Ibrahim2021-08-31 07:41:17 +00:00Commented Aug 31, 2021 at 7:41
- Please provide enough code so others can better understand or reproduce the problem.Community– Community Bot2021-09-02 17:22:12 +00:00Commented Sep 2, 2021 at 17:22
1 Answer
I don't know the specifics of how your AI framework opens a browser nor the operating system you are using. I am using windows 10 and have installed Chrome in the default location.
Changing your default browser using the operating system, may work:
- Open Default apps
- Under Web browser, select the browser currently listed, and then select Google Chrome
Or you can use this method - it works even if chrome isn't your default browser:
import webbrowser url = 'https://www.python.org' path = 'C:/Program Files/Google/Chrome/Application/chrome.exe' webbrowser.register('mybrowser', None, webbrowser.BackgroundBrowser(path)) webbrowser.get('mybrowser').open(url) You can fetch the location of the chrome executable from the registry with the key:
HKML\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe Or find it using the shell command:
dir /s /b \chrome.exe See also:
How to change the default browser used by jupyter in windows
How to change the default browser used by jupyter in Linux
Change your default browser in Windows 10