无法使用 Raspberry Pi 删除 Python virtualenv 中的 SSL 安全错误 [英] Unable to remove SSL Security error inside a Python virtualenv with Raspberry Pi

查看:22
本文介绍了无法使用 Raspberry Pi 删除 Python virtualenv 中的 SSL 安全错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题,希望得到帮助.我的 Python 代码使用 HTTPS 上的请求模块通过 Internet 获取 JSON 信息.尽管我必须按照 中所述安装 OpenSSL/PyOpenSSL,但在非 virtenv Python 实例中一切正常此链接可删除不安全的平台通知.

I have an odd problem that I am hoping to get help with. My Python code uses the Requests module over HTTPS to get JSON information over the Internet. Everything works smoothly in the non-virtenv Python instance although I had to install OpenSSL/PyOpenSSL as discussed in this link to remove an insecure platform notification.

现在作为玩 Flask 的一部分,我创建了一个虚拟环境.不幸的是,SSL 错误又回来了,上面链接中列出的每种方法都不起作用.这是错误信息:

Now as part of playing with Flask, I have created a Virtual Environment. Unfortunately, the SSL error is back and every method listed in the link above does not work. Here is the error message:

/home/pi/.virtualenvs/flasktest1/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:90:InsecurePlatformWarning:真正的 SSLContext 对象不可用.这会阻止 urllib3 正确配置 SSL,并可能导致某些 SSL 连接失败.有关更多信息,请参阅https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.不安全平台警告

/home/pi/.virtualenvs/flasktest1/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:90: 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. InsecurePlatformWarning

最明显的解决方案是在 virtenv 中安装 OpenSSL/PyOpenSSL,但不幸的是安装失败并出现下面列出的错误.

The most obvious solution is to install OpenSSL/PyOpenSSL inside the virtenv, but unfortunately the installation fails with the error listed below.

命令/home/pi/.virtualenvs/flasktest1/bin/python -c"导入设置工具,tokenize;file='/tmp/pip-build-6D2PfU/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), 文件,'exec'))" install --record/tmp/pip-o43kpB-record/install-record.txt--single-version-externally-managed --compile --install-headers/home/pi/.virtualenvs/flasktest1/include/site/python2.7/cffi" 失败/tmp/pip-build-6D2PfU/cffi 中的错误代码为 1

Command "/home/pi/.virtualenvs/flasktest1/bin/python -c "import setuptools, tokenize;file='/tmp/pip-build-6D2PfU/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-o43kpB-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/pi/.virtualenvs/flasktest1/include/site/python2.7/cffi" failed with error code 1 in /tmp/pip-build-6D2PfU/cffi

我现在不知如何解决这个问题.需要明确的是,此应用程序是在防火墙后面开发的,仅用于实验目的,不会公开访问.但是,这个错误造成了困难,我只想让它停止.

I am now at a loss how to fix this. To be clear, this app is being developed behind a firewall and is for experimentation purposes only and will not be publicly accessible. However, this error is causing difficulties and I just want to make it stop.

先谢谢你!

推荐答案

对于我 (OS X 10.10),pip install pyopenssl ndg-httpsclient pyasn1 解决了这个问题.

For me (OS X 10.10), a pip install pyopenssl ndg-httpsclient pyasn1 fixed the issue.

这篇关于无法使用 Raspberry Pi 删除 Python virtualenv 中的 SSL 安全错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆