运行python脚本时,报错InsecurePlatformWarning: A true SSLContext object is not available,解决方法
今天,要在新环境里运行一个python脚本,遇到下面的报错:
/usr/lib/python2.7/site-packages/urllib3/util/ssl_.py:160: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a new......
报错跟安全策略相关,网上搜了下,是因为python版本的原因(用的是python2.7.5),解决办法要么升级python 版本,要么安装requests,
本着牵动最小的原则,决定采用后者,如下:
pip install requests[security]
安装完成后,重新运行python脚本,还是一样的报错,又尝试了
pip install pyopenssl ndg-httpsclient pyasn1(等同于安装requests)
安装完成后,重新运行python脚本,还是一样的报错,想到一个惯用伎俩——upgrade
pip install --upgrade requests[security]
安装完成后,重新运行python脚本,果然,不再报InsecurePlatformWarning错了
题外话:InsecurePlatformWarning的错没有了,但又报了另一个错CryptographyDeprecationWarning,详细信息如下:
/usr/lib64/python2.7/site-packages/cryptography/hazmat/primitives/constant_time.py:26: CryptographyDeprecationWarning: Support for your Python version is deprecated. The next version of cryptography will remove support. Please upgrade to a 2.7.x release that supports hmac.compare_digest as soon as possible.
utils.DeprecatedIn23
提醒升级python版本,但此时脚本不涉及安全的情况下,能够正常往下执行。
运行python脚本时,报错InsecurePlatformWarning: A true SSLContext object is not available,解决方法的更多相关文章
- 启动tomcat时,报错:IOException while loading persisted sessions: java.io.EOFException解决方法
报错原因:加载持久化session错误,tomcat加载时读取的文件是是*.ser,session序列化文件,文件的位置是tomcat\work\Catalina\localhost,找到sessio ...
- 命令行运行Python脚本时传入参数的三种方式
原文链接:命令行运行Python脚本时传入参数的三种方式(原文的几处错误在此已纠正) 如果在运行python脚本时需要传入一些参数,例如gpus与batch_size,可以使用如下三种方式. pyth ...
- 使用IDEA操作Hbase API 报错:org.apache.hadoop.hbase.client.RetriesExhaustedException的解决方法:
使用IDEA操作Hbase API 报错:org.apache.hadoop.hbase.client.RetriesExhaustedException的解决方法: 1.错误详情: Excepti ...
- flask+sqlite3+echarts2+ajax数据可视化报错:UnicodeDecodeError: 'utf8' codec can't decode byte解决方法
flask+sqlite3+echarts2+ajax数据可视化报错: UnicodeDecodeError: 'utf8' codec can't decode byte 解决方法: 将 py文件和 ...
- 【pycharm】pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法
pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法 解决方法: 在pycharm的安装目 ...
- pip安装模块警告InsecurePlatformWarning: A true SSLContext object is not available.
在用pip7.1.2版本安装第三方模块时出现了如下警告: /usr/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/_vendor/reques ...
- 禁止requests请求https的提示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
提示这个 InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from ...
- [经验总结] 在 windows 命令窗口中运行 python 脚本时提示 ModuleNotFoundError: No module named 'xxx'
先给出的代码和目录结构 获取CPU代码如下: # -*- coding:utf-8 -*- ''' Created on Sep 10, 2018 @author: ''' import sys im ...
- 命令行运行python项目文件,报错:ModuleNotFoundError: No module named 'xxxx' 解决办法
在pycharm中写好了自动化测试脚本,并能在pycharm中正常运行,由于要考虑到无人值守时能自动执行,执行时就需要脱离pycharm,直接能用命令执行.但是直接用命令执行用例文件:python3 ...
随机推荐
- object的wait()、notify()、notifyAll()、方法和Condition的await()、signal()方法
wait().notify()和notifyAll()是 Object类 中的方法 从这三个方法的文字描述可以知道以下几点信息: 1)wait().notify()和notifyAll()方法是本地方 ...
- 虚拟机中安装Linux系统
本教程的运行环境:Windows 10 , 虚拟机 VirtualBox,Ubuntu 16.04 1.准备 下载 VirtualBox 下载OVA镜像64位 http://releases.ubun ...
- C# T 泛型类,泛型方法的约束条件用法
class A<T> where T:new() 这是类型参数约束,where表名了对类型变量T的约束关系.where T:A 表示类型变量是继承于A的,或者是A本省.where T: n ...
- HDU - 6054String and String
题意:给串s和t,对于串s每个位置有一个价值f,两种操作1.修改f[a]=b,2.查询串t子串Ta-b在s的子串Sc-d中出现位置的f和 题解:s和t建sam,把fail树按dfs序建bit套线段树, ...
- python 报错 TabError: inconsistent use of tabs and spaces in indentation
写python的时候如果出现如题的错误 TabError: inconsistent use of tabs and spaces in indentation 意为:制表符错误:缩进中制表符和空格使 ...
- mui预加载
1.只能加载一个页面 mui.init(); var page = null; mui.plusReady(function() { //预加载页面mui.preload必须放在plusReady事件 ...
- java 形式参数和实际参数的区别
1.形参不能离开方法.形参只有在方法内才会发生作用,也只有在方法中使用,不会在方法外可见.而实参可以再程序的任何地方都使用.
- C++ DWORD 转byte char 数组、指针
C++ DWORD 转byte char 数组.指针 byte byteData[1024]; // byte数组,示例 DWORD dwData = dwReadBytes; // dword数据, ...
- liunx定时任务
为当前用户创建cron服务 1. 键入 crontab -e 编辑crontab服务文件 例如 文件内容如下: */2 * * * * /bin/sh /home/admin/jiaoben/bu ...
- 李航《统计学习方法》CH02
CH02 感知机 前言 章节目录 感知机模型 感知机学习策略 数据集的线性可分性 感知机学习策略 感知机学习算法 感知机学习算法 感知机学习算法的原始形式 算法的收敛性 感知机学习算法的对偶形式 导读 ...