【发布时间】:2019-06-06 17:12:30
【问题描述】:
部署我的 Python 函数应用程序后,当我尝试在 Azure 云上运行它时,它失败并出现以下错误:如何在运行应用程序服务的机器上安装 azure-storage?请帮忙。
将 azure.functions 导入为 func 导入日期时间
导入操作系统、uuid、sys 从 azure.storage.blob 导入 BlockBlobService,PublicAccess ...... ......
【问题讨论】:
-
错误:-----执行函数时出现异常:Functions.HttpTrigger 结果:失败异常:ModuleNotFoundError:没有名为“azure.storage”的模块堆栈:文件“/usr/local/lib/ python3.6/site-packages/azure/functions_worker/dispatcher.py",第 230 行,在 _
-
您是否有包含您的功能所需的包的 requirements.txt 文件? link to docs
-
是的,这是txt文件的内容 azure-storage-blob==1.5.0 azure-storage-common==1.4.2 azure-storage-file==1.4.0 azure- storage-queue==1.4.0 azure-functions azure-functions-worker grpcio==1.14.1 grpcio-tools==1.14.1 protobuf==3.6.1 六==1.11.0
-
然后如果我在 requirements.txt 中填充了上述内容,我会在部署时收到此错误:还原依赖项时出错。错误:无法安装 cryptography-2.7 依赖项:没有轮子的二进制依赖项不是支持的。使用 --build-native-deps 选项使用 Docker 容器自动构建和配置依赖项。更多信息aka.ms/func-python-publish
-
@Thmsdnnr 非常感谢您指出这一点。我实际上遵循了这一点并且没有工作。然而,在全新安装核心工具和 Docker 之后,我设法构建了包并运行了它。这是我使用的构建命令: func azure functionapp publish
--build-native-deps
标签: python-3.x azure azure-functions