解决SSL InsecurePlatformWarning问题
最近使用requests库进行操作时总出现如下警告:
InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
虽然不影响程序执行,不过看着一个警告还是心理不舒服.
解决办法很简单,安装几个包即可pip install pyopenssl ndg-httpsclient pyasn1
安装过程中可能出现某些头文件不存在的错误,比如
openssl/aes.h: No such file or directory
fatal error: ffi.h: No such file or directory
安装对应的dev包即可,比如ubuntu下就是
sudo apt-get install libffi-dev libssl-dev