我仍然收到此错误:启动内核时发生错误
我尝试的事情:
这是在我更新了我不应该拥有的spyder后开始发生的,但现在我遇到了问题。我将在IPhython控制台屏幕上分享即将发布的完整消息。
Traceback (most recent call last):
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 245, in
main()
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 213, in main
from ipykernel.kernelapp import IPKernelApp
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\ipykernel\__init__.py", line 2, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\ipykernel\connect.py", line 18, in
import jupyter_client
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\jupyter_client\__init__.py", line 4, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\jupyter_client\connect.py", line 22, in
import zmq
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\__init__.py", line 34, in
from zmq import backend
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\__init__.py", line 40, in
reraise(*exc_info)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\__init__.py", line 27, in
_ns = select_backend(first)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\select.py", line 26, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\cython\__init__.py", line 6, in
from . import (constants, error, message, context,
ImportError: cannot import name 'constants'
Traceback (most recent call last):
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 245, in
main()
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 213, in main
from ipykernel.kernelapp import IPKernelApp
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\ipykernel\__init__.py", line 2, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\ipykernel\connect.py", line 18, in
import jupyter_client
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\jupyter_client\__init__.py", line 4, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\jupyter_client\connect.py", line 22, in
import zmq
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\__init__.py", line 34, in
from zmq import backend
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\__init__.py", line 40, in
reraise(*exc_info)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\__init__.py", line 27, in
_ns = select_backend(first)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\select.py", line 26, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\cython\__init__.py", line 6, in
from . import (constants, error, message, context,
ImportError: cannot import name 'constants'
Traceback (most recent call last):
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 245, in
main()
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 213, in main
from ipykernel.kernelapp import IPKernelApp
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\ipykernel\__init__.py", line 2, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\ipykernel\connect.py", line 18, in
import jupyter_client
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\jupyter_client\__init__.py", line 4, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\jupyter_client\connect.py", line 22, in
import zmq
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\__init__.py", line 34, in
from zmq import backend
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\__init__.py", line 40, in
reraise(*exc_info)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\__init__.py", line 27, in
_ns = select_backend(first)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\select.py", line 26, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\cython\__init__.py", line 6, in
from . import (constants, error, message, context,
ImportError: cannot import name 'constants'
Traceback (most recent call last):
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 245, in
main()
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 213, in main
from ipykernel.kernelapp import IPKernelApp
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\ipykernel\__init__.py", line 2, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\ipykernel\connect.py", line 18, in
import jupyter_client
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\jupyter_client\__init__.py", line 4, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\jupyter_client\connect.py", line 22, in
import zmq
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\__init__.py", line 34, in
from zmq import backend
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\__init__.py", line 40, in
reraise(*exc_info)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\__init__.py", line 27, in
_ns = select_backend(first)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\select.py", line 26, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\cython\__init__.py", line 6, in
from . import (constants, error, message, context,
ImportError: cannot import name 'constants'
Traceback (most recent call last):
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 245, in
main()
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 213, in main
from ipykernel.kernelapp import IPKernelApp
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\ipykernel\__init__.py", line 2, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\ipykernel\connect.py", line 18, in
import jupyter_client
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\jupyter_client\__init__.py", line 4, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\jupyter_client\connect.py", line 22, in
import zmq
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\__init__.py", line 34, in
from zmq import backend
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\__init__.py", line 40, in
reraise(*exc_info)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\__init__.py", line 27, in
_ns = select_backend(first)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\select.py", line 26, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36\Lib\site‑packages\zmq\backend\cython\__init__.py", line 6, in
from . import (constants, error, message, context,
ImportError: cannot import name 'constants'
答案 0 :(得分:2)
问题是您安装了两个Python版本:
C:\Users\afsan\Anaconda3\
C:\Users\afsan\AppData\Local\Programs\Python\Python36
鉴于您似乎想要将Spyder与Anaconda一起使用,请删除您的第二个Python版本(如果需要,请手动删除)。这应该可以解决你的问题。