使用“sam构建”创建AWS lambda函数时出错

2024-04-24 01:30:19 发布

您现在位置:Python中文网/ 问答频道 /正文

运行sam build --use-containers创建使用下载库的AWS python 3.8 lambda函数时,我遇到一个错误:

pip._vendor.requests.exceptions.SSLError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/d0/32/6c367f54699bd51961cf3e10299f6dee976f0f6813210052a4d8c2bd1d2b/pymemcache-3.2.0-py2.py3-none-any.whl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate is not yet valid (_ssl.c:1108)')))

我在https://files.pythonhosted.org上检查了证书,证书标记为从2020年7月13日开始。目前是2020年7月14日

我发现我可以设置trusted hosts选项以避免这种情况(类似于:pip install fails with "connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)"),但是当通过脚本从容器中运行PIP时,我不知道如何设置它

if看起来也可以使用环境变量来设置PIP受信任主机,但我不确定如何在SAM使用的docker映像中设置它

(在windows 10系统上运行)


Tags: piporgsslwithfilescertificate证书verify