在 Spyder 的 IPython 控制台中启动内核时出现 PermissionError
PermissionError while starting the kernel in Spyder's IPython console
当我启动 spyder
时,出现此错误:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site‑packages\spyder\plugins\ipythonconsole.py", line 1572, in create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle)
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "C:\ProgramData\Anaconda3\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "C:\ProgramData\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\Sébastien\AppData\Roaming\jupyter\runtime\kernel‑e1f2b044843b.json'
我在编程方面一点经验都没有,但我尝试在 Anaconda 提示符下输入命令,但是 none 这行得通("conda update jupyter_client"
和 "conda update --all"
)
我也尝试安装和卸载,但我仍然得到同样的错误。
这似乎是一个权限问题。 运行Spyder as administrator(右击->运行as administrator)解决问题
更新:
根据@CarlosCordoba:"To fix this the OP needs to run conda update anaconda
and then conda update jupyter_client
in the Anaconda Prompt"
请注意,原来的解决方法在这种情况下同样有效。
对我有帮助的是允许不安全的写入:
yourPythonPath\scripts\activate.bat
set JUPYTER_ALLOW_INSECURE_WRITES=1
spyder
或者,您也可以在全局 Windows 环境变量中将 JUPYTER_ALLOW_INSECURE_WRITES 设置为 1。
当我启动 spyder
时,出现此错误:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site‑packages\spyder\plugins\ipythonconsole.py", line 1572, in create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle)
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "C:\ProgramData\Anaconda3\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "C:\ProgramData\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\Sébastien\AppData\Roaming\jupyter\runtime\kernel‑e1f2b044843b.json'
我在编程方面一点经验都没有,但我尝试在 Anaconda 提示符下输入命令,但是 none 这行得通("conda update jupyter_client"
和 "conda update --all"
)
我也尝试安装和卸载,但我仍然得到同样的错误。
这似乎是一个权限问题。 运行Spyder as administrator(右击->运行as administrator)解决问题
更新:
根据@CarlosCordoba:"To fix this the OP needs to run conda update anaconda
and then conda update jupyter_client
in the Anaconda Prompt"
请注意,原来的解决方法在这种情况下同样有效。
对我有帮助的是允许不安全的写入:
yourPythonPath\scripts\activate.bat
set JUPYTER_ALLOW_INSECURE_WRITES=1
spyder
或者,您也可以在全局 Windows 环境变量中将 JUPYTER_ALLOW_INSECURE_WRITES 设置为 1。