jupyter notebook "kernel error" solution (FileNotFoundError: [WinError 2])

What to do if a kernel error is displayed when you start jupyter notebook and the error code "FileNotFoundError: [WinError 2] The specified file cannot be found" appears even if you execute it.The cause is that the executable file (python.exe) does not exist in the reference destination.

Occurrence Status

When I copied the Anaconda environment (contents of the envs folder) built on another online PC to an offline PC and started jupyter notebook, a kernel error was displayed.
I can't run anything by hitting the code.

Environment
OS: windows 10
Miniconda version: 4.6.12
Python version: 3.7.1.final.0

jupyter notebook kernel error
kernel error

Error code

Failed to start the kernel
Unhandled error
Traceback (most recent call last):
File “C: \ Users \ Miniconda3 \ envs \ ML \ lib \ site-packages \ tornado \ web.py”, line 1699, in _execute
result = await result
(~ Abbreviation ~)
FileNotFoundError: [WinError 2] The specified file cannot be found.

Cause

It seems that the cause is that the executable file of the program language (python.exe in this case) cannot be accessed.

solution

Check the reference address of python.exe and correct it. You can find the address in a file called "kernel.json".

kernel.json
C: \ ~Omission~ \ envs \ Name of created virtual environment \ share \ jupyter \ kernels \ python3 It is in ←.

Open it with Notepad and correct it to the correct address.

{
“Argv”: [
“C: \ ~ Omitted ~ \ envs \ Name of created virtual environment \ python.exe”, ← This address was incorrect
“-M”,
“Ipykernel_launcher”,
“-F”,
“{Connection_file}”
],
“Display_name”: “Python 3”,
“Language”: “python”
}

After the fix, when I start jupyter notebook, it says kernel ready and I can run it.

jupyter notebook kernel error

reference
https://github.com/jupyter/notebook/issues/4079