hgjgh 发表于 2018-8-8 11:49:31

python之报错的解决(持续总结)

  1UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
  今天在部署代码的时候,报了一个异常,经过百度后得知是 字符集问题,处理办法如下:
  在文件前加两句话:
reload(sys)  
sys.setdefaultencoding("utf-8")
  2使用requests 模块的时候报错:
C:\Python27\lib\site-packages\requests\packages\urllib3\util\ssl_.py:100: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuri  
ng SSL appropriately and may cause certain SSL connections to fail. For more information,
  
see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  
InsecurePlatformWarning
  是由于缺少一些ssl的支持包。解决办法:
pip install requests  出处:http://stackoverflow.com/questions/29134512/insecureplatformwarning-a-true-sslcontext-object-is-not-available-this-prevent
页: [1]
查看完整版本: python之报错的解决(持续总结)