解決Jupyter因卸載重裝導(dǎo)致的問題修復(fù)
因?yàn)橐恍┰?卸載了Anaconda2的版本,轉(zhuǎn)向3..發(fā)現(xiàn)Jupyter掛了.百思不得其解.后來了解到是因?yàn)閮?nèi)核找不到的問題導(dǎo)致的.這里整理了一下處理辦法
錯(cuò)誤內(nèi)容:
Traceback (most recent call last): File "c:\program files\python36\lib\site-packages\tornado\web.py", line 1543, in _execute result = yield result File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 1099, in run value = future.result() File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 1107, in run yielded = self.gen.throw(*exc_info) File "c:\program files\python36\lib\site-packages\notebook\services\sessions\handlers.py", line 73, in post type=mtype)) File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 1099, in run value = future.result() File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 1107, in run yielded = self.gen.throw(*exc_info) File "c:\program files\python36\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 79, in create_session kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name) File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 1099, in run value = future.result() File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 1107, in run yielded = self.gen.throw(*exc_info) File "c:\program files\python36\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 92, in start_kernel_for_session self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name) File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 1099, in run value = future.result() File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 315, in wrapper yielded = next(result) File "c:\program files\python36\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 148, in start_kernel super(MappingKernelManager, self).start_kernel(**kwargs) File "c:\program files\python36\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel km.start_kernel(**kwargs) File "c:\program files\python36\lib\site-packages\jupyter_client\manager.py", line 259, in start_kernel **kw) File "c:\program files\python36\lib\site-packages\jupyter_client\manager.py", line 204, in _launch_kernel return launch_kernel(kernel_cmd, **kw) File "c:\program files\python36\lib\site-packages\jupyter_client\launcher.py", line 128, in launch_kernel proc = Popen(cmd, **kwargs) File "c:\program files\python36\lib\subprocess.py", line 709, in __init__ restore_signals, start_new_session) File "c:\program files\python36\lib\subprocess.py", line 997, in _execute_child startupinfo) FileNotFoundError: [WinError 2] 系統(tǒng)找不到指定的文件。
解決辦法
首先使用jupyter kernelspec list查看安裝的內(nèi)核和位置
2.進(jìn)入安裝內(nèi)核目錄打開kernel.jason文件,查看Python編譯器的路徑是否正確(其實(shí)筆者的問題就是因?yàn)槁窂讲徽_導(dǎo)致的),修改錯(cuò)誤的這個(gè)配置.
3.重啟jupyter notebook即可
網(wǎng)絡(luò)上一些其他解決辦法
1.首先使用jupyter kernelspec list查看安裝的內(nèi)核和位置
2.進(jìn)入安裝內(nèi)核目錄打開kernel.jason文件,查看Python編譯器的路徑是否正確
如果不正確python -m ipykernel install --user重新安裝內(nèi)核,如果有多個(gè)內(nèi)核,如果你使用conda create -n python2 python=2,為Python2.7設(shè)置conda變量,那么在anacoda下使用activate pyhton2切換python環(huán)境,重新使用python -m ipykernel install --user安裝內(nèi)核
3.重啟jupyter notebook即可
補(bǔ)充知識:關(guān)于jupyter內(nèi)核(kernel)錯(cuò)誤處理方法
首先明確起因:
卸載重裝,或者之前有裝過ipython,導(dǎo)致再次安裝后,內(nèi)核匹配的路徑錯(cuò)誤,沒有指向新安裝的位置。理論上有兩種處理方法:
方法一:
手動(dòng)修改路徑:
1.首先使用jupyter kernelspec list查看安裝的內(nèi)核和位置
2.進(jìn)入安裝內(nèi)核目錄打開kernel.jason文件,查看Python編譯器的路徑 是否正確(其實(shí)筆者的問題就是因?yàn)槁窂讲徽_導(dǎo)致的),修改錯(cuò)誤的這個(gè)配置.
3.重啟jupyter notebook即可
注:理論上沒有問題,但是我在實(shí)踐的時(shí)候沒有查找到這個(gè)文件,可能是版本問題,如果有經(jīng)驗(yàn)的話,這個(gè)方法比較快捷。
方法二:
暴力重裝:
暴力的意思就是徹底重裝,之前我有試過sudo pip3,sudo -H以及一些其他方法,但是沒有效果。
以下方法最后解決了我的問題:
sudo pip3 install --upgrade --force-reinstall --no-cache-dir jupyter
以上這篇解決Jupyter因卸載重裝導(dǎo)致的問題修復(fù)就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
python實(shí)現(xiàn)簡單的計(jì)時(shí)器功能函數(shù)
這篇文章主要介紹了python實(shí)現(xiàn)簡單的計(jì)時(shí)器功能函數(shù),涉及Python操作時(shí)間的技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-03-03
Pandas DataFrame中的tuple元素遍歷的實(shí)現(xiàn)
這篇文章主要介紹了Pandas DataFrame中的tuple元素遍歷的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-10-10
Python實(shí)現(xiàn)將json文件生成C語言的結(jié)構(gòu)體的腳本分享
這篇文章主要為大家詳細(xì)介紹了Python如何實(shí)現(xiàn)將json文件生成C語言的結(jié)構(gòu)體,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2022-09-09
python爬不同圖片分別保存在不同文件夾中的實(shí)現(xiàn)
這篇文章主要介紹了python爬不同圖片分別保存在不同文件夾中的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-04-04
如何用pandas讀取一個(gè)文件或某個(gè)文件夾下所有文件
這篇文章主要介紹了如何用pandas讀取一個(gè)文件或某個(gè)文件夾下所有文件問題,具有很好的參考價(jià)值,希望對大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-02-02
Pytorch-Geometric中的Message?Passing使用及說明
這篇文章主要介紹了Pytorch-Geometric中的Message?Passing使用及說明,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-12-12

