python之報錯的解決(持續總結)

1  UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)  html

今天在部署代碼的時候,報了一個異常,通過百度後得知是 字符集問題,處理辦法以下:python

在文件前加兩句話:
app

reload(sys)
sys.setdefaultencoding("utf-8")

2  使用requests 模塊的時候報錯:ide

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的支持包。解決辦法:this

pip install requests[security]

出處:http://stackoverflow.com/questions/29134512/insecureplatformwarning-a-true-sslcontext-object-is-not-available-this-prevent url

相關文章
相關標籤/搜索