【问题标题】:Requests in vs code has a wrong caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")vs code 中的请求有一个错误,由 SSLError("Can't connect to HTTPS URL because the SSL module is not available.")
【发布时间】:2019-09-14 09:19:03
【问题描述】:

我在网上搜索了很长时间。但是没有用。请帮助或尝试提供一些想法如何实现这一点。谢谢! 我想通过vs代码爬取https,但是运行代码的时候出现了错误。(在jupyter notebook中运行正常,我的python安装在E:/)

import requests

url = 'https://stackoverflow.com/'
res = requests.get(url)

requests.exceptions.SSLError: 
HTTPSConnectionPool(host='stackoverflow.com', port=443): Max retries exceeded with url: / (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))

【问题讨论】:

  • 我也有同样的问题...在cmd中测试请求时可以,但是在vscode中失败。

标签: python https openssl


【解决方案1】:

ssl 模块未与您在 VS Code 中使用的 Python 版本一起安装,因此requests 无法建立 HTTPS 连接。尝试在 VS Code 中安装了 ssl 模块的另一个 Python 版本,或者看看是否可以使用 ssl 重新安装 Python。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-01-05
    • 2022-12-27
    • 2021-10-12
    • 1970-01-01
    • 1970-01-01
    • 2019-06-05
    • 2019-12-17
    • 1970-01-01
    相关资源
    最近更新 更多