창에서 주피터 노트북에서 사용하는 기본 브라우저를 변경하는 방법
창에서 주피터 노트북에서 사용하는 기본 브라우저를 변경하는 방법
나는 관리자 권한이 없는 윈도우 머신에 있고 기본 브라우저는 다른 브라우저인데 크롬에서 주피터를 실행하고 싶다.
나는 아나콘다 배포판의 로컬 설치를 가지고 있고 주피터를 시작하는 첫 번째 옵션은 아나콘다 내비게이터를 통해 하는 것이지만, 아마도 나는 다른 일을 해야 할 것이다. 로컬 설치이기 때문에 명령줄에서 결과가 나타나지 않습니다.
기본 브라우저에 있는 URL 주소를 붙여넣으면 크롬 페이지에서 비밀번호나 토큰을 묻습니다. 나는 비밀번호도 없고 토큰이 무엇인지도 모른다.
아나콘다 내비게이터의 브라우저를 변경할 수 있는 방법이 있나요? 아니면 크롬으로 어떻게 주피터를 시작할 수 있을까?
열리는 기본 브라우저를 변경할 방법은 없는 것으로 알고 있습니다. 그러나 시작 메뉴에서 Anaconda Prompt를 열고 입력하면 노트북 서버에 대한 토큰을 찾을 수 있습니다
jupyter notebook list
이렇게 하면 다른 브라우저에 복사/붙여넣을 수 있는 토큰이 포함된 URL이 제공됩니다. 명령의 출력은 다음과 같습니다
Currently running servers:
http://localhost:8888/?token=41429d3dcf554d0dde69498aac0950654a590664ba02b3cd :: /path/to/home/folder
따라서 브라우저에 입력한 다음 토큰을 필드에 복사/붙여넣거나, 토큰과 함께 전체 URL을 복사/붙여넣을 수 있습니다.
Windows에 대한 자세한 내용은 모르지만 Mac에서 기본 브라우저를 설정하는 방법은 다음과 같습니다:
jupyter notebook --generate-config
그러면 ~/.jupyter에 jupyter_notebook_config.py 파일이 생성됩니다. 선 편집
#c.NotebookApp.browser = ''
Mac에서 다음으로 설정했습니다:
c.NotebookApp.browser = u'open -a /Applications/Gooogle\ Chrome.app %s'
윈도우에서 크롬을 가리키는 방법만 알아내면 된다.
@Darthbith와 이 게시물 덕분에 나는 그것을 알아낼 수 있었다:
1단계: 시작 메뉴에서 Anaconda 프롬프트를 열고 입력하려면
# for old notebook and JupyterLab < 3.0, or
jupyter notebook --generate-config
# for new nbclassic and JupyterLab >= 3.0
jupyter server --generate-config
그러면 파일(또는 nbclassic/new JupyterLab용)이 생성됩니다
2단계: 이 파일을 편집하고 다음 행을 변경합니다(chrome은 로컬 설치에도 있음)
# for old notebook and JupyterLab < 3.0
c.NotebookApp.browser = u'C:/Home/AppData/Local/Google/Chrome/Application/chrome.exe %s'
# OR for new nbclassic and JupyterLab >= 3.0
c.ServerApp.browser = u'C:/Home/AppData/Local/Google/Chrome/Application/chrome.exe %s'
Windows(윈도우)에서는 cmd/Anaconda Prompt(cmd/Anaconda 프롬프트):
jupyter notebook --generate-config
생성된 jupyter_notebook_config.py 파일은 "C:\Users\성함이\"입니다.jupyter\" 폴더.
텍스트 편집기를 사용하여 열고 다음으로 변경합니다
import webbrowser
webbrowser.register('chrome', None, webbrowser.GenericBrowser(u'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'))
c.NotebookApp.browser = 'chrome'
파일을 저장합니다.
이제 주피터-노트북 명령을 실행하면 설정된 브라우저가 사용됩니다.
위의 설명은 제게 맞지 않았어요, 제가 뭔가 잘못 입력했나 봐요. 사실 내가 기본 브라우저를 크롬으로 변경하고 다음 출시 후에 주피터가 크롬에서 자동으로 시작되는 것이 더 쉬웠다(Windows 검색 - 기본 브라우저 변경).
다음 사항도 저에게 도움이 됩니다. 크롬으로 가는 완전한 길을 열어주고, 마지막에.
jupyter notebook --browser='C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
만약 크롬이 PATH 환경 변수 안에 있다면, 다음과 같은 것들도 가능할 것이다.
jupyter notebook --browser=chrome
#댓글 표시기를 제거하여 라인을 활성화해야 합니다.
주피터는 어떤 브라우저를 실행할지 선택할 때 환경 변수를 찾습니다.
Jupyter를 구체적으로 구성하는 것보다 설정하는 것을 추천합니다. 설정은 어떤 애플리케이션에 적용되든 상관없이 원하는 브라우저를 지정할 수 있는 기본 방법이기 때문입니다.
단일 세션의 브라우저를 선택하려면 쥬피터 프로세스를 실행할 때 환경 변수를 설정합니다.
PATH에서 크롬 브라우저를 사용하는 것을 선호할 수 있습니다. Linux의 경우 일반적입니다.
PATH에 애플리케이션이 없을 때. Windows용으로 일반적입니다.
그렇지않으면.
전체 시스템의 브라우저를 선택하려면 환경 변수를 전역적으로 설정합니다.
.../jupyter/runtime/nbserver-11596-open.html 파일을 찾거나 파일 이름이 무엇이든 주피터 노트북이 시작할 때 파일 이름을 찾을 수 있고 Chorme과 연결할 수 있습니다.
크롬이 내 기본 브라우저가 아니었던 Win10의 Anaconda에서 크롬으로 주피터 노트북을 실행하려고 시도한 것에 대해 상당히 격앙된 후, 나는 위의 몇 가지 제안을 조합했고, 내 홈 디렉토리의 .jupyter 아래에 있는 jupyter_notebook_config.py 파일에 기본 c 대신 이러한 줄을 입력했다.노트북 앱.브라우저 라인, 드디어 작동했습니다!:
import webbrowser
webbrowser.register('chrome', None, webbrowser.GenericBrowser(u'C:/PROGRA~2/Google/Chrome/Application/chrome.exe'))
c.NotebookApp.browser = 'chrome'
유닉스 스타일의 디렉터리 구분자를 사용하는 것과 도스 스타일의 "PROGRA~2"를 사용하는 것에 주목하라. "chrome.exe" 뒤에 "%s"를 추가하는 것은 도움이 되지 않는 것처럼 보였다.
당신의 jupyter_notebook_config.py 파일에 무엇을 넣어야 하는지에 대해 다른 답변들에 포함된 것보다 조금 더 많은 정보를 제공하고 싶습니다. jupyter는 python의 모듈을 사용하여 c 값을 전달하여 브라우저를 실행하고 있다.NotebookApp.브라우저를 사용하여 기능을 찾습니다. 값이 지정되지 않은 경우 함수는 사용자의 기본 브라우저를 선택합니다. 여기서 값을 지정하면 지정한 값이 문자로 끝나는지 여부에 따라 두 가지 방식 중 하나로 해석할 수 있습니다.
문자열이 문자를 포함하지 않는 경우 브라우저 이름으로 해석되며 모듈은 해당 이름으로 등록된 브라우저가 있는지 확인합니다(기본적으로 브라우저가 등록된 파이썬 문서 참조). 이것이 Abhirup Das의 답변이 작동하는 이유이다, 먼저 웹브라우저 모듈을 불러온다
import webbrowser
크롬 브라우저가 모듈에 등록되어 있는 경우
webbrowser.register('chrome', None, webbrowser.GenericBrowser(u'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'))
그리고 마지막으로, 주피터 서버는 브라우저 이름을 입력 받는다
c.NotebookApp.browser = 'chrome'
이 브라우저 등록은 지속되지 않으므로 서버가 시작될 때마다 프로세스를 반복해야 합니다.
또는 문자열에 문자가 포함되어 있으면 리터럴 브라우저 명령어로 해석합니다. 이 질문은 브라우저를 실행하는 방법에 관한 것이므로 브라우저 명령에는 백슬래시(backslash)가 포함될 수 있습니다. 백슬래시는 파이썬 스트링 리터럴에서 특별한 의미가 있는 문자를 피하기 위해 사용된다. 브라우저 명령에서 백슬래시를 제거하거나 교체해야 합니다. 가장 쉬운 방법은 명령어의 백슬래시를 새 슬래시로 바꾸는 것이다.
'C:/Home/AppData/Local/Google/Chrome/Application/chrome.exe %s'
보다는
'C:\Home\AppData\Local\Google\Chrome\Application\chrome.exe %s'
평생 유니코드/raw 문자열 명령어나 각 백슬래시를 탈출한 명령어를 추가 백슬래시로 작업할 수 없었기 때문에 백슬래시를 포워드 슬래시로 대체하는 것이 유일한 선택일 수 있습니다. 나는 내가 시도한 문자열이 모두 파이썬에서 작동한다는 것을 확인했기 때문에 확실한 방법은 주피터 소스 코드를 보는 것뿐이다.
어쨌든, 모듈에 브라우저를 등록하는 것이 지속되지 않기 때문에 브라우저가 기본적으로 아직 등록되어 있지 않다면 백슬래시를 순방향 슬래시로 대체한 리터럴 브라우저 명령을 사용하는 것이 가장 좋습니다.
아나콘다 프롬프트를 열고 입력합니다
jupyter notebook --generate-config
그런 다음 " jupyter_notebook_config.py" 경로로 이동하여 다음 행을 추가합니다
c.NotebookApp.browser = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
jupyter_notebook_config 파일에서는 아무것도 변경할 필요가 없습니다. 기본 웹 브라우저(크롬인 경우) 또는 재설정 여부를 확인하고 기본 브라우저로 웹 브라우저(chrome)를 다시 선택합니다. 그것은 나에게 효과가 있었다.
마이크로소프트는 엣지를 윈도우 상에서 지속적인 바이러스로 설정했다. 설정에서 기본 브라우저를 크롬으로 설정해도 주피터를 열 때 엣지가 생깁니다.. 이는 마이크로소프트가 엣지를 .htm과 .html 파일의 기본 앱으로 설정했기 때문이다. 앱 기본 설정에서 해당 설정을 찾아 크롬으로 변경하면 모든 설정이 완료됩니다..
Mac에서는 다음과 같이 작동합니다:
1) 환경 내에서 구성 파일을 생성합니다:
jupyter notebook --generate-config
이것은 안에 들어갈 것이다.
2) 에서 다음 행을 수정합니다:
c.NotebookApp.browser = 'open -a /Applications/Google\ Chrome.app %s'
윈도우 10에서 이를 달성하기 위해서는 다음과 같은 작업을 수행해야 했다:
Anaconda Prompt CLI에서 브라우저를 일시적으로 선택/지정하는 경우(따옴표의 순서/유형에 유의하십시오.) 대부분의 다른 답변들과 다른 답변들이 제게 맞지 않는 것 같습니다:
jupyter notebook --browser="'C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe' %s"
영구적으로 설정하려면 .jupyter 폴더에서 jupyter_notebook_config.py 파일을 편집합니다. 백슬래시(즉, \vs just)에서 벗어날 필요가 있는지는 확실하지 않지만, 다음을 사용해보니 효과가 있었습니다(다시 말하지만, 따옴표의 순서/종류가 다릅니다):
c.NotebookApp.browser = '"C:\\Program Files (x86)\\BraveSoftware\\Brave-Browser\\Application\\brave.exe" %s'
쉬운 단계: 1. 노트북을 실행할 때 선택하는 현재 브라우저를 제거합니다. 2. 노트북을 다시 실행하면 브라우저를 요청합니다. 필요한 것을 선택하고 다음과 같은 문구를 활성화합니다. 이러한 유형의 파일에 대해 항상 이 응용 프로그램을 선택합니다.
그건 작동할 것이다. 브라우저를 다시 설치합니다.
저의 경우 아나콘다 1.9.12를 탑재한 macOS 10.15.4, 마지막으로 아래와 같은 효과적인 것을 발견했습니다:
c.NotebookApp.browser = u'/Applications/Google\Chrome.app/Contents/MacOS/Google\Chrome %s'
누군가에게 도움이 되었으면 좋겠어요. :-)
/tmp에서 크롬으로 주피터를 실행할 수 있는 방법이 있나요?
something like that:
jupyter notebook --browser='google-chrome --user-data-dir=/tmp/'
For linux users:
First generate config file using: jupyter notebook --generate-config
Then open the generated file and look for #c.NotebookApp.browser = ''
Edit it to : c.NotebookApp.browser = '/bin/brave %s'
Replace /bin/brave with whatever your browser executable location is.
Jupyterlab 3 migrated from notebook server to plain jupyter server. To select the browser jupyter lab
will open, put the config in .jupyter/jupyter_server_config.py
and replace NotebookApp
by ServerApp
. For example:
c.ServerApp.browser = '/usr/bin/firefox -P notebook --new-window %s'
here are the steps
Open Anaconda promt and write:
jupyter notebook --generate-config
go to that path and open with a text editor the .py file
In that file look for the line that constains the follow text:
#c.NotebookApp.browser = ''
Befor that line write the follow code
import webbrowser webbrowser.register('chrome', None, webbrowser.GenericBrowser(u'C:/PROGRA~2/Google/Chrome/Application/chrome.exe'))
drop de symbol # in the lines to set the browser, so it looks like:
c.NotebookApp.browser = ''
save the file, this makes Chrome as a default browser to launch jupyter notebook
There is a much simpler way than typing commands in the command window, you can use the Windows file explorer! Simply navigate to the following path C:\Users\**YourUser**\AppData\Roaming\jupyter\runtime\
, as below:
There, among other files, you will see the corresponding .html
files of your jupyter jobs. You can right-click on any .html
file, select "Open As" as then select other application (as shown on the image below - apologies my default language is in Spanish).
From here, you can select the most suitable navigator for you. In my case I am using Firefox, but you can choose Chrome or whatever (as shown below). Make sure to click the "Use always this application to open .html files" checkbox to set Chrome as the default navigator.
From now on, Jupyter Notebooks will always open in Chrome. Hope it helped!
Check your default browser's configurations, The default browser is where the Jupyter Notebook will open in.
on Windows, Simply change it doing:
Search in the start menu "Default apps", open it.
Under Web browser, select the browser currently listed, and then simply change it to your desired browser (where you want the Jupyter Notebook to open).
use this command(windows cmd):
jupyter notebook --browser NotebookApp.browser
it generates a link (localhost link), copy paste it in any browser that you need and use you notebook.
if you didn't specify a browser for your jupyter notebook, maybe just changing the default browser of your operating system can solve your issue; like it did for me. check default browser in window: default apps: web browser
I was looking for a way to temporarily override the default browser when launching jupyter lab. Therefore, all the other solutions based on generating a general config in the user home were not ideal.
Fortunately, it turns out that the same setting can be easily passed via the command line as well, which I think wasn't mentioned here yet:
jupyter lab --ServerApp.browser='google-chrome'
Tested with jupyter lab version 4.0.1.
Although this is not an answer to the question 'how to change Jupyter default browser' per se, this may help: open Jupyter Notebook and open the browser of preference (I am using Opera now). In the Notebook you will see: Click any link and the you'd have Jupyter open in that browser.