Python报错“AttributeError: module 'sys' has no attribute 'setdefaultencoding'问题”

Posted yznmj-112

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python报错“AttributeError: module 'sys' has no attribute 'setdefaultencoding'问题”相关的知识,希望对你有一定的参考价值。

    1. Python3中写法:
      import imp
      import sys
      imp.reload(sys)
       
      Python2中写法:
      import sys 
      reload(sys) 
      sys.setdefaultencoding("utf-8")

以上是关于Python报错“AttributeError: module 'sys' has no attribute 'setdefaultencoding'问题”的主要内容,如果未能解决你的问题,请参考以下文章

python报错: AttributeError module 'time' has no attribute 'clock'

Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法

python-pip升级报错- AttributeError: 'NoneType' object has no attribute 'bytes'

Python 报错 AttributeError: module 'django.db.models' has no attribute 'SubfieldBase'(

Python - celery 相关报错 - AttributeError: type object '_multiprocessing.win32' has no attribute

python报错提示 AttributeError: ‘bytes’ object has no attribute ‘encode’、