十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
创新互联www.cdcxhl.cn八线动态BGP香港云服务器提供商,新人活动买多久送多久,划算不套路!
成都创新互联公司专注于松桃企业网站建设,响应式网站建设,商城网站开发。松桃网站建设公司,为松桃等地区提供建站服务。全流程按需网站设计,专业设计,全程项目跟踪,成都创新互联公司专业和态度为您提供的服务这篇文章将为大家详细讲解有关anaconda spyder出错怎么办,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
anaconda spyder出错解决:
写Python程序时突然遇到报错:
This command failed to be executed because an error occurred while trying to get the file code from Spyder's editor. The error was: An exception has occurred, use %tb to see the full traceback. UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 582: illegal multibyte sequence UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 611: illegal multibyte sequence In [2]: %tb Traceback (most recent call last): File "C:\Users\peter\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 401, in get_file_code return f.read() UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 582: illegal multibyte sequence
先尝试重启程序,也许报错就解决了。
解决方法是根据报错,修改文件C:\Users\peter\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py为:
def get_file_code(filename): """Retrive the content of a file.""" # Get code from spyder try: file_code = frontend_request().get_file_code(filename) except (CommError, TimeoutError): file_code = None if file_code is None: with open(filename, 'r',encoding='utf-8') as f:#增加 ,encoding='utf-8' return f.read() return file_code
如果不重启程序,会报错:
[autoreload of spydercustomize failed: Traceback (most recent call last): File "C:\Users\peter\Anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 245, in check superreload(m, reload, self.old_objects) File "C:\Users\peter\Anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 394, in superreload module = reload(module) File "C:\Users\peter\Anaconda3\lib\imp.py", line 314, in reload return importlib.reload(module) File "C:\Users\peter\Anaconda3\lib\importlib\__init__.py", line 168, in reload raise ModuleNotFoundError(f"spec not found for the module {name!r}", name=name) ModuleNotFoundError: spec not found for the module 'spydercustomize' ] This command failed to be executed because an error occurred while trying to get the file code from Spyder's editor. The error was: An exception has occurred, use %tb to see the full traceback. UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 582: illegal multibyte sequence
关于anaconda spyder出错怎么办就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。