一、问题描述
spyder提示更新3.4.1版本,手贱跑去更新了一下,更新完之后spyder蛛网加载完后就闪退,开始查资料解决。
二、解决方法
首先打开anaconda终端,输入spyder回车查询错误信息:
(base) C:\Users\DELL>spyder
fromIccProfile: failed minimal tag size sanity
F:\anaconda\lib\site-packages\paramiko\transport.py:220: CryptographyDeprecationWarning: Blowfish has been deprecated
"class": algorithms.Blowfish,
Traceback (most recent call last):
File "F:\anaconda\Scripts\spyder-script.py", line 10, in <module>
sys.exit(main())
File "F:\anaconda\lib\site-packages\spyder\app\start.py", line 252, in main
mainwindow.main(options, args)
File "F:\anaconda\lib\site-packages\spyder\app\mainwindow.py", line 1822, in main
mainwindow = create_window(MainWindow, app, splash, options, args)
File "F:\anaconda\lib\site-packages\spyder\app\utils.py", line 289, in create_window
main.setup()
File "F:\anaconda\lib\site-packages\spyder\app\mainwindow.py", line 773, in setup
PLUGIN_REGISTRY.register_plugin(self, PluginClass,
File "F:\anaconda\lib\site-packages\spyder\api\plugin_registration\registry.py", line 342, in register_plugin
instance = self._instantiate_spyder5_plugin(
File "F:\anaconda\lib\site-packages\spyder\api\plugin_registration\registry.py", line 184, in _instantiate_spyder5_plugin
plugin_instance = PluginClass(main_window, configuration=CONF)
File "F:\anaconda\lib\site-packages\spyder\api\plugins\new_api.py", line 331, in __init__
container.setup()
File "F:\anaconda\lib\site-packages\spyder\plugins\pythonpath\container.py", line 55, in setup
self._load_pythonpath()
File "F:\anaconda\lib\site-packages\spyder\plugins\pythonpath\container.py", line 136, in _load_pythonpath
system_path = get_system_pythonpath()
File "F:\anaconda\lib\site-packages\spyder\plugins\pythonpath\utils.py", line 31, in get_system_pythonpath
env = get_user_env()
File "F:\anaconda\lib\site-packages\spyder\utils\environ.py", line 71, in get_user_env
env_dict = get_user_environment_variables()
File "F:\anaconda\lib\site-packages\spyder\utils\environ.py", line 60, in get_user_environment_variables
res = stdout.decode().strip().split(os.linesep)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 134: invalid start byte
这里显示的是编码错误,最重要的是找到文件记录里面的最后一个文件environ.py,然后找到对应的第60行:
res = stdout.decode().strip().split(os.linesep)
environ.py文件开头已经有# -*- coding: utf-8 -*-,所以多半是中文编码问题,在这句代码的decode()的括号中加上'gbk',:
res = stdout.decode('gbk').strip().split(os.linesep)
重启spyder,发现成功运行。不过我之前reset过spyder的设置,不知道是否必要,如果不成功可以在anaconda终端试试:
(base) C:\Users\DELL>spyder --reset
三、结论
我记得我上次更新spyder也出现问题,还是重装环境解决的,这次又没记住教训,以后能不更新就不更新吧,遇到UnicodeDecodeError:'utf-8' ……多半和中文编码有关系,看看哪里有中文路径或者需要加一个decode('gbk')啥的吧。
其他类似问题及解决方法:
(12条消息) Spyder闪退、启动失败的解决办法。UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa9 in position 226······-CSDN博客文章来源:https://www.toymoban.com/news/detail-510282.html
(12条消息) spyder调试遇到错误UnicodeDecodeError: 'utf-8' codec can't decode byte 0xca in position 218: 解决办法_spyder unicodedecodeerror: 'utf-8' codec can't dec_ARM小妖的博客-CSDN博客文章来源地址https://www.toymoban.com/news/detail-510282.html
到了这里,关于SPYDER更新后打不开:UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xb5 in position 134的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!