我尝试通过Anaconda通过Jupyter Notebook打开的每个ipynb文件都无法连接到内核,实际上甚至没有尝试连接。 Jupyter Notebook会在浏览器中正常打开,但不会运行任何代码。
Anaconda给我的错误消息如下:
[I 15:38:18.048 NotebookApp] Serving notebooks from local directory: C:\Users\Steve
[I 15:38:18.049 NotebookApp] The Jupyter Notebook is running at:
[I 15:38:18.049 NotebookApp] http://localhost:8888/?token=75ab5a1e4589ed4fa66fa16492bdc0584a84639efc712416
[I 15:38:18.049 NotebookApp] or http://127.0.0.1:8888/?token=75ab5a1e4589ed4fa66fa16492bdc0584a84639efc712416
[I 15:38:18.049 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 15:38:18.055 NotebookApp]
To access the notebook, open this file in a browser:
file:///C:/Users/Steve/AppData/Roaming/jupyter/runtime/nbserver-15480-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=75ab5a1e4589ed4fa66fa16492bdc0584a84639efc712416
or http://127.0.0.1:8888/?token=75ab5a1e4589ed4fa66fa16492bdc0584a84639efc712416
[I 15:38:26.193 NotebookApp] Creating new notebook in
[E 15:38:27.450 NotebookApp] Uncaught exception POST /api/sessions (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri='/api/sessions', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\tornado\web.py", line 1699, in _execute
result = await result
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
type=mtype))
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\tornado\gen.py", line 209, in wrapper
yielded = next(result)
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\contextlib.py", line 81, in __enter__
return next(self.gen)
File "C:\Users\Steve\Anaconda3\envs\new_environment\lib\site-packages\jupyter_client\connect.py", line 102, in secure_write
with os.fdopen(os.open(fname, open_flag, 0o600), mode) as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Steve\\AppData\\Roaming\\jupyter\\runtime\\kernel-9f77512a-5ebb-4c1c-9424-822866aea3f4.json'
[W 15:38:27.505 NotebookApp] Unhandled error
[E 15:38:27.505 NotebookApp] {
"Host": "localhost:8888",
"Connection": "keep-alive",
"Content-Length": "92",
"Sec-Fetch-Mode": "cors",
"Origin": "http://localhost:8888",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36",
"Content-Type": "application/json",
"Accept": "application/json, text/javascript, */*; q=0.01",
"X-Requested-With": "XMLHttpRequest",
"X-Xsrftoken": "2|66b1ff4a|c8810c10c2029743f6e43f5b8c7e29ef|1570744041",
"Sec-Fetch-Site": "same-origin",
"Referer": "http://localhost:8888/notebooks/Untitled3.ipynb?kernel_name=python3",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-US,en;q=0.9",
"Cookie": "Pycharm-44e71070=4fa7cb1b-2805-4f1c-aaf0-577baa9ae985; Pycharm-696e27d1=4fa7cb1b-2805-4f1c-aaf0-577baa9ae985; PHPSESSID=ldjk9643lfk0l0vpcdkebqc5q1; _xsrf=2|66b1ff4a|c8810c10c2029743f6e43f5b8c7e29ef|1570744041; username-localhost-8889=\"2|1:0|10:1570819273|23:username-localhost-8889|44:YTA2MDEwMTI5YTU2NDE2NTkxNjRmMTQ5NmFjMTc4MmQ=|fe85d8a96c8311868f1969ac2da91a261d24b9dea2f001178e0edcac8bef9d7e\"; username-localhost-8890=\"2|1:0|10:1570819397|23:username-localhost-8890|44:ZmY3OTI4MWEyMzA5NDUxMDljMzFlOGFkMmI4Zjg2YmU=|4dcbe5ab640d7fb5fc84a975b6b888a8c5804c7768c26e28385dd035329f5001\"; username-localhost-8891=\"2|1:0|10:1570820146|23:username-localhost-8891|44:Yjk2MWM4ZWI4ZjZhNDdmNjk2MDg0NjA2YTQ2MTlkNDU=|2e5947c7adb689cb99e7d083087d06f246bfe9b3fb7c82dc415ab623a1f5198f\"; username-localhost-8888=\"2|1:0|10:1570822699|23:username-localhost-8888|44:MGM5ZDkyMjQ3MDE5NDU3NTgwYTI4YjQ1MDIwNGRjMmM=|0cafba0718d17f5817e2cdea01cef574217a1146c3a43a75c35d56a89997c3e9\""
}
[E 15:38:27.506 NotebookApp] 500 POST /api/sessions (::1) 128.72ms referer=http://localhost:8888/notebooks/Untitled3.ipynb?kernel_name=python3
[W 15:38:27.530 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20191011153817 (::1) 22.94ms referer=http://localhost:8888/notebooks/Untitled3.ipynb?kernel_name=python3
Jupyter给我的错误消息是:
Traceback (most recent call last):
File "C:\Users\Steve\Anaconda3\lib\site-packages\tornado\web.py", line 1699, in _execute
result = await result
File "C:\Users\Steve\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Steve\Anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
type=mtype))
File "C:\Users\Steve\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Steve\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Steve\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\Users\Steve\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Steve\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Steve\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "C:\Users\Steve\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Steve\Anaconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper
yielded = next(result)
File "C:\Users\Steve\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "C:\Users\Steve\Anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\Steve\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "C:\Users\Steve\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "C:\Users\Steve\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "C:\Users\Steve\Anaconda3\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "C:\Users\Steve\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 102, in secure_write
with os.fdopen(os.open(fname, open_flag, 0o600), mode) as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Steve\\AppData\\Roaming\\jupyter\\runtime\\kernel-3317f363-fbcb-4b37-87da-03c98ac0176a.json
我为纠正这种情况所做的尝试是:
这些尝试都没有成功,我将感谢有更多技术来处理Anaconda和Jupyter Notebook的人的帮助。谢谢!