Spyder闪退问题分析 成功解决办法

重启了电脑,意外出现spyder闪退。。。

尝试

1 重启 不行

2 用cmd 打开spyder 不行

PS C:\Users\10928> spyder --new-instance
link image0 hasn't been detected!
Traceback (most recent call last):
  File "C:\D\anaconda\Scripts\spyder-script.py", line 10, in 
    sys.exit(main())
  File "C:\D\anaconda\lib\site-packages\spyder\app\start.py", line 251, in main
    mainwindow.main(options, args)
  File "C:\D\anaconda\lib\site-packages\spyder\app\mainwindow.py", line 1992, in main
    mainwindow = create_window(MainWindow, app, splash, options, args)
  File "C:\D\anaconda\lib\site-packages\spyder\app\utils.py", line 292, in create_window
    main.post_visible_setup()
  File "C:\D\anaconda\lib\site-packages\spyder\app\mainwindow.py", line 1222, in post_visible_setup
    self.projects.reopen_last_project()
  File "C:\D\anaconda\lib\site-packages\spyder\plugins\projects\plugin.py", line 578, in reopen_last_project
    self.open_project(path=current_project_path,
  File "C:\D\anaconda\lib\site-packages\spyder\plugins\projects\plugin.py", line 433, in open_project
    project_type_class = self._load_project_type_class(path)
  File "C:\D\anaconda\lib\site-packages\spyder\plugins\projects\plugin.py", line 864, in _load_project_type_class
    config.read(fpath)
  File "C:\D\anaconda\lib\configparser.py", line 697, in read
    self._read(fp, filename)
  File "C:\D\anaconda\lib\configparser.py", line 1020, in _read
    for lineno, line in enumerate(fp, start=1):
UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 373: illegal multibyte sequence

3 用anaconda navigator 打开spyder 不行

报错

Traceback (most recent call last):
File "C:\D\anaconda\Scripts\spyder-script.py", line 10, in 
sys.exit(main())
File "C:\D\anaconda\lib\site-packages\spyder\app\start.py", line 237, in main
mainwindow.main(options, args)
File "C:\D\anaconda\lib\site-packages\spyder\app\mainwindow.py", line 1992, in main
mainwindow = create_window(MainWindow, app, splash, options, args)
File "C:\D\anaconda\lib\site-packages\spyder\app\utils.py", line 292, in create_window
main.post_visible_setup()
File "C:\D\anaconda\lib\site-packages\spyder\app\mainwindow.py", line 1222, in post_visible_setup
self.projects.reopen_last_project()
File "C:\D\anaconda\lib\site-packages\spyder\plugins\projects\plugin.py", line 578, in reopen_last_project
self.open_project(path=current_project_path,
File "C:\D\anaconda\lib\site-packages\spyder\plugins\projects\plugin.py", line 433, in open_project
project_type_class = self._load_project_type_class(path)
File "C:\D\anaconda\lib\site-packages\spyder\plugins\projects\plugin.py", line 864, in _load_project_type_class
config.read(fpath)
File "C:\D\anaconda\lib\configparser.py", line 697, in read
self._read(fp, filename)
File "C:\D\anaconda\lib\configparser.py", line 1020, in _read
for lineno, line in enumerate(fp, start=1):
UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 373: illegal multibyte sequence

导致问题的原因

与之前的变化

报错中
UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xaf in position 373: illegal multibyte sequence
首先我从ubuntu系统复制了文件放在win下之前的项目中了,或许跟文件解码有关。
所以先移除了这个文档。
但是还是不行,或许是spyder默认的编解码方式改变了,尝试reset

在powershell中

 spyder  --reset

不行

成功方法

在anaconda prompt 执行

spyder --reset C
(base) C:\Users\10928>spyder --reset C
*** Reset Spyder settings to defaults ***
removing: C:\Users\10928\.spyder-py3\help
removing: C:\Users\10928\.spyder-py3\onlinehelp
removing: C:\Users\10928\.spyder-py3\temp.py
removing: C:\Users\10928\.spyder-py3\template.py
removing: C:\Users\10928\.spyder-py3\history.py
removing: C:\Users\10928\.spyder-py3\history_internal.py
removing: C:\Users\10928\.spyder-py3\workingdir
removing: C:\Users\10928\.spyder-py3\langconfig
removing: C:\Users\10928\.spyder-py3\spyder.lock
removing: C:\Users\10928\.spyder-py3\config\spyder.ini
removing: C:\Users\10928\.spyder-py3\config\transient.ini
removing: C:\Users\10928\.spyder-py3\plugins

成功!

你可能感兴趣的:(python,python)