我的目标是使用VS代码和Python在本地开发Azure函数。我有一个带有时间触发器的Azure函数模板:
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环境),我将得到以下内容:
> 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。
发布于 2020-06-28 09:27:11
检查PATH系统环境变量中是否有{your_conda_env_installation_path}\Library\bin。
这就是DLL的位置。
重新加载代码编辑器。通过运行venv\Scripts\python.exe测试修复程序
import ssl如果模块加载时没有DLL错误,则应该可以工作。
https://stackoverflow.com/questions/62595433
复制相似问题