快速解決jupyter啟動卡死的問題
問題描述
系統:Win10;之前安裝過Cpython,現在依次使用pip install ipython與pip install jupyter安裝了 Ipython 6.5.0與 jupyter 1.0.0。但是在PowerShell上使用命令jupyter notebook 執行jupyter時伺服器始終卡頓,根本沒法用。
解決方法
使用命令jupyter notebook --generate-config 可看到檔案 jupyter_notebook_config.py位置
手動開啟檔案進行編輯,找到c.NotebookApp.notebook_dir 修改預設目錄並去掉註釋儲存,最好修改目錄到非C盤 c.NotebookApp.notebook_dir = 'E:\\Program Files\Python3_6_6\jupyter'(大約246行,注意磁碟名後面是雙斜線)
jupyter notebook啟動伺服器,正常執行
補充知識:jupyter notebook 瀏覽器開啟空白卡死情況
jupyter notebook 需要用谷歌瀏覽器開啟才可以,其他的瀏覽器開啟後多半是空白的。新增預設瀏覽器如下:
1.在anaconda prompt 裡面直接輸入或cmd中輸入(前提是已經將anaconda加入環境變數):
jupyter notebook --generate-config
讓jupyter生成一個配置檔案,生成後你會看到檔案地址的,如圖所示:
C:\Users\Administrator\.jupyter\jupyter_notebook_config.py
2.然後就可以使用記事本之類的,開啟這個jupyter_notebook_config.py檔案
然後查詢,browser,找到如下程式碼:
## Specify what command to use to invoke a web browser when opening the notebook. # If not specified,the default browser will be determined by the `webbrowser` # standard library module,which allows setting of the BROWSER environment # variable to override it. #c.NotebookApp.browser = u''
在這個後面,新增如下程式碼(google瀏覽器):
## Specify what command to use to invoke a web browser when opening the notebook. # If not specified,which allows setting of the BROWSER environment # variable to override it. #c.NotebookApp.browser = '' import webbrowser webbrowser.register('chrome',None,webbrowser.GenericBrowser(u'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe')) c.NotebookApp.browser = 'chrome'
以上這篇快速解決jupyter啟動卡死的問題就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支援我們。