首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用VS代码进行Azure函数本地开发时的SSLError

使用VS代码进行Azure函数本地开发时的SSLError
EN

Stack Overflow用户
提问于 2020-06-26 13:08:50
回答 1查看 1.6K关注 0票数 4

我的目标是使用VS代码和Python在本地开发Azure函数。我有一个带有时间触发器的Azure函数模板:

代码语言:javascript
复制
import datetime
import logging

import azure.functions as func

def main(mytimer: func.TimerRequest) -> None:
    utc_timestamp = datetime.datetime.utcnow().replace(
        tzinfo=datetime.timezone.utc).isoformat()

    if mytimer.past_due:
        logging.info('The timer is past due!')

    logging.info('Python timer trigger function ran at %s', utc_timestamp)

我尝试在VS代码中通过调试在本地运行(conda环境),我将得到以下内容:

代码语言:javascript
复制
> Executing task: .venv\Scripts\python -m pip install -r requirements.txt <

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting azure-functions==1.2.1 (from -r requirements.txt (line 1))
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/azure-functions/
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/azure-functions/
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/azure-functions/
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/azure-functions/
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/azure-functions/
  Could not fetch URL https://pypi.org/simple/azure-functions/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/azure-functions/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  ERROR: Could not find a version that satisfies the requirement azure-functions==1.2.1 (from -r requirements.txt (line 1)) (from versions: none)
ERROR: No matching distribution found for azure-functions==1.2.1 (from -r requirements.txt (line 1))
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ 
(Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
The terminal process terminated with exit code: 1

我已经添加了提到的这里路径变量

我还找到了一种使用--trusted-host (链接在这里)安装软件包的方法,但我不知道如何在Azure函数中使用它,因为它利用了requirements.txt。我想,您不能在--trusted-host中使用requirements.txt。

EN

回答 1

Stack Overflow用户

发布于 2020-06-28 09:27:11

检查PATH系统环境变量中是否有{your_conda_env_installation_path}\Library\bin。

这就是DLL的位置。

  • libcrypto-1_1-x64.
  • libssl-1_1-x64.

重新加载代码编辑器。通过运行venv\Scripts\python.exe测试修复程序

代码语言:javascript
复制
import ssl

如果模块加载时没有DLL错误,则应该可以工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62595433

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档