解决打开Spyder时闪退的问题

1.直接控制台,输入spyder run,看有什么报错提示

C:\Users\aa>spyder run
link image0 hasn't been detected!
D:\Soft\Anaconda3\lib\site-packages\paramiko\transport.py:219: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
Bad file descriptor (C:\ci\zeromq_1616055400030\work\src\epoll.cpp:100)
[60816:67636:0214/221001.457:ERROR:broker_win.cc(59)] Error reading broker pipe: 管道已结束。 (0x6D)

2.找了一些大佬的解决方法,说 pip check

C:\Users\aa>pip check
spyder 5.2.2 requires pyqt5, which is not installed.
spyder 5.2.2 requires pyqtwebengine, which is not installed.
daal4py 2021.6.0 requires daal, which is not installed.
anaconda-project 0.11.1 requires ruamel-yaml, which is not installed.
conda-repo-cli 1.0.20 has requirement clyent==1.2.1, but you have clyent 1.2.2.
conda-repo-cli 1.0.20 has requirement nbformat==5.4.0, but you have nbformat 5.5.0.

 3.就安装了一下pyqt5、pyqtwebengine包,推荐安装老的版本

C:\Users\aa>pip install pyqt5==5.12.3 -i https://pypi.tuna.tsinghua.edu.cn/simple

C:\Users\aa>pip install pyqtwebengine==5.12.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

4.安装后再次运行,还是不可以

C:\Users\绾绾>spyder run
D:\Soft\Anaconda3\lib\site-packages\paramiko\transport.py:219: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
Bad file descriptor (C:\ci\zeromq_1616055400030\work\src\epoll.cpp:100)

5.找了一些大佬的解决方法,说 重新安装旧版本的 pyzmq

C:\Users\aa>pip uninstall pyzmq
Found existing installation: pyzmq 23.2.0
Uninstalling pyzmq-23.2.0:
  Would remove:
    d:\soft\anaconda3\lib\site-packages\pyzmq-23.2.0.dist-info\*
    d:\soft\anaconda3\lib\site-packages\zmq\*
Proceed (Y/n)? y
  Successfully uninstalled pyzmq-23.2.0

C:\Users\aa>pip install pyzmq==19.0.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pyzmq==19.0.2
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/b8/3d/3c10e21c485e7f4f668563a33aa770488b8ca37647e0dd2c64b37d52bd12/pyzmq-19.0.2-cp39-cp39-win_amd64.whl (695 kB)
     ---------------------------------------- 695.1/695.1 kB 3.1 MB/s eta 0:00:00
Installing collected packages: pyzmq
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
spyder-kernels 2.2.1 requires pyzmq>=22.1.0; python_version >= "3", but you have pyzmq 19.0.2 which is incompatible.
jupyter-client 7.3.4 requires pyzmq>=23.0, but you have pyzmq 19.0.2 which is incompatible.
Successfully installed pyzmq-19.0.2

6.安装后再次运行,还是不可以

C:\Users\绾绾>spyder --new-instance
D:\Soft\Anaconda3\lib\site-packages\paramiko\transport.py:219: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
Traceback (most recent call last):
  File "D:\Soft\Anaconda3\Scripts\spyder-script.py", line 10, in <module>
    sys.exit(main())
  File "D:\Soft\Anaconda3\lib\site-packages\spyder\app\start.py", line 251, in main
    mainwindow.main(options, args)
  File "D:\Soft\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 2016, in main
    mainwindow = create_window(MainWindow, app, splash, options, args)
  File "D:\Soft\Anaconda3\lib\site-packages\spyder\app\utils.py", line 300, in create_window
    main.post_visible_setup()
  File "D:\Soft\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 1169, in post_visible_setup
    plugin.on_mainwindow_visible()
  File "D:\Soft\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\plugin.py", line 376, in on_mainwindow_visible
    self.create_new_client(give_focus=False)
  File "D:\Soft\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\plugin.py", line 508, in create_new_client
    self.get_widget().create_new_client(
  File "D:\Soft\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\widgets\main_widget.py", line 1545, in create_new_client
    self.connect_client_to_kernel(client, is_cython=is_cython,
  File "D:\Soft\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\widgets\main_widget.py", line 1605, in connect_client_to_kernel
    kc.start_channels(shell=True, iopub=True)
  File "D:\Soft\Anaconda3\lib\site-packages\qtconsole\kernel_mixins.py", line 47, in start_channels
    super().start_channels(*args, **kw)
  File "D:\Soft\Anaconda3\lib\site-packages\jupyter_client\threaded.py", line 279, in start_channels
    self.shell_channel._inspect = self._check_kernel_info_reply
  File "D:\Soft\Anaconda3\lib\site-packages\jupyter_client\client.py", line 355, in shell_channel
    socket = self.connect_shell(identity=self.session.bsession)
  File "D:\Soft\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 621, in connect_shell
    return self._create_connected_socket("shell", identity=identity)
  File "D:\Soft\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 605, in _create_connected_socket
    sock = self.context.socket(socket_type)
  File "D:\Soft\Anaconda3\lib\site-packages\zmq\sugar\context.py", line 226, in socket
    s = self._socket_class(self, socket_type, **kwargs)
  File "D:\Soft\Anaconda3\lib\site-packages\zmq\_future.py", line 144, in __init__
    self._init_io_state()
  File "D:\Soft\Anaconda3\lib\site-packages\zmq\asyncio\__init__.py", line 53, in _init_io_state
    self.io_loop.add_reader(self._fd, lambda : self._handle_events(0, 0))
  File "D:\Soft\Anaconda3\lib\asyncio\events.py", line 504, in add_reader
    raise NotImplementedError
NotImplementedError
Exception ignored in: <function Socket.__del__ at 0x000001B4A3EC5EE0>
Traceback (most recent call last):
  File "D:\Soft\Anaconda3\lib\site-packages\zmq\sugar\socket.py", line 67, in __del__
    self.close()
  File "D:\Soft\Anaconda3\lib\site-packages\zmq\_future.py", line 160, in close
    self._clear_io_state()
  File "D:\Soft\Anaconda3\lib\site-packages\zmq\asyncio\__init__.py", line 60, in _clear_io_state
    self.io_loop.remove_reader(self._fd)
  File "D:\Soft\Anaconda3\lib\asyncio\events.py", line 507, in remove_reader
    raise NotImplementedError
NotImplementedError:

7.找了一些大佬的解决方法(点),说在anaconda安装目录\lib\site-packages\tornado\platform\asyncio.py开头添加代码:

import sys
 
if sys.platform == 'win32':
  asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

8. 然后再spyder –new-instance,就启动spyder成功了

 

物联沃分享整理
物联沃-IOTWORD物联网 » 解决打开Spyder时闪退的问题

发表评论