2016-01-13 114 views
2

在Windows 7 64位運行ipyhton筆記本電腦和啓動與Python 2內核筆記本我得到一個錯誤:IPython的筆記本,如何設置正確的路徑內核

Traceback (most recent call last): 
    File "C:\Users\USER1\Anaconda2\lib\site-packages\notebook\base\handlers.py", line 436, in wrapper 
    result = yield gen.maybe_future(method(self, *args, **kwargs)) 
    File "C:\Users\USER1\Anaconda2\lib\site-packages\notebook\services\sessions\handlers.py", line 56, in post 
    model = sm.create_session(path=path, kernel_name=kernel_name) 
    File "C:\Users\USER1\Anaconda2\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 66, in create_session 
    kernel_name=kernel_name) 
    File "C:\Users\USER1\Anaconda2\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 84, in start_kernel 
    **kwargs) 
    File "C:\Users\USER1\Anaconda2\lib\site-packages\jupyter_client\multikernelmanager.py", line 109, in start_kernel 
    km.start_kernel(**kwargs) 
    File "C:\Users\USER1\Anaconda2\lib\site-packages\jupyter_client\manager.py", line 244, in start_kernel 
    **kw) 
    File "C:\Users\USER1\Anaconda2\lib\site-packages\jupyter_client\manager.py", line 190, in _launch_kernel 
    return launch_kernel(kernel_cmd, **kw) 
    File "C:\Users\USER1\Anaconda2\lib\site-packages\jupyter_client\launcher.py", line 115, in launch_kernel 
    proc = Popen(cmd, **kwargs) 
    File "C:\Users\USER1\Anaconda2\lib\subprocess.py", line 710, in __init__ 
    errread, errwrite) 
    File "C:\Users\USER1\Anaconda2\lib\subprocess.py", line 958, in _execute_child 
    startupinfo) 
WindowsError: [Error 2] The system cannot find the file specified 

我進一步調查,我加入了以下proc = Popen(cmd, **kwargs)之前打印線launcher.py文件中

print cmd 
    print kwargs 

現在我看到proc = Popen(cmd, **kwargs)被調用CMD =

['C:\\Users\\USER1\\Anaconda2_32bit\\python.exe', '-m', 'ipykernel', '-f', ' 
C:\\Users\\USER1\\AppData\\Roaming\\jupyter\\runtime\\kernel-a3f46334-4491-4 
fef-aeb1-6772b8392954.json'] 

這是一個問題,因爲我的python.exe不

C:\\Users\\USER1\\Anaconda2_32bit\\python.exe 

C:\\Users\\USER1\\Anaconda2\\python.exe 

但是我有電腦/高級系統設置/高級/環境變量和\\Anaconda2_32bit\\檢查路徑從來沒有在那裏指定。

因此,我懷疑錯誤的路徑是指定的其他地方。這可能在哪裏,我該如何解決?

另外我以前曾在\\Anaconda2_32bit\\上安裝過Anaconda,但我已經卸載了它。

回答

6

IPython的具有特殊配置文件 註冊內核我已經運行命令:

ipython kernelspec list 

輸出是:

Available kernels: 
    python2 C:\ProgramData\jupyter\kernels\python2 

我已經調查C:\ProgramData\jupyter\kernels\python2\kernel.json文件,並有一個錯誤的道路設置爲python2。我已經修復了路徑,現在它已經可以工作了。