python - 无法使用 Raspberry Pi 删除 Python virtualenv 中的 SSL 安全错误

标签 python ssl virtualenv

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

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

/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,但不幸的是安装失败并出现以下错误。

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

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

提前致谢!

最佳答案

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

关于python - 无法使用 Raspberry Pi 删除 Python virtualenv 中的 SSL 安全错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29989632/

相关文章:

python - 关于逻辑回归的问题

ssl - 使用ADFS身份验证将文件上传到Prem SSL上的Sharepoint

java - Java SSLContextImpl$TLS10Context 的随机 "peer not authenticated"异常

python - Pycharm 在配置为使用 virtualenv 解释器时使用基本解释器

debian - 无法在 Debian Squeeze 上使用 Pip 安装 Virtualenv

python - Hadoop MapReduce(使用 Python)在 Pandas DataFrame 上启动 KeyError

python - 输入两个单独的列表并输出单个字典列表

python - 来自时间戳的日期时间返回错误的年份

url - 什么改变了请求的 URL?

python - 如何从 python 代码激活/停用 virtualenv?