簡體   English   中英

嘗試從 VSCode 將帶有 requirements.txt 的 flask 應用程序部署到 Azure Web 應用程序時缺少“gcc”錯誤

[英]Missing “gcc” error when trying to deploy a flask app with requirements.txt to Azure Web App from VSCode

From within VSCode, using the Azure web service extension, I can deploy a Hello-World flask app successfully to my Azure web app (linux, python 3.6 stack).

當我嘗試部署我真正的 flask 應用程序(在 requirements.txt 中列出了依賴項)文件時,我將“pip install --upgrade -r requirements.txt”指定為 web 應用程序“啟動命令”,在 Z3AF580F1422203677 中瀏覽web 應用程序頁面給出“應用程序錯誤”。

我的 web 應用程序的日志顯示,由於錯誤無法執行 'gcc': No such file or directory ,嘗試構建“psutil”時啟動代碼失敗。

當上述失敗時,我還嘗試使用“輪子”作為我的部署的一部分,如此處所述( https://blogs.msdn.microsoft.com/azureossds/2015/06/29/install-native-python-modules-on -azure-web-apps-api-apps/ ),但這似乎並沒有改變任何東西(同樣的“缺少 gcc”錯誤)。

這是從 VSCode 部署具有 python 庫依賴項的 flask 應用程序的正確方法嗎? 我希望部署過程會自動處理 requirements.txt(無需指定啟動命令),並且我希望它能夠安裝 python 庫而不會出錯。

Due to you were using Azure WebApp for Linux based on Docker Container, the MSDN blog Install Python Modules on Azure App Services for Azure WebApp for Windows is not useful for your issue.

因此,對於您缺少gcc錯誤的問題,根據我的經驗,解決該問題的解決方案是配置一個自定義 Linux 容器,該容器已預先安裝 gcc 到您的應用程序代碼鏈中。

作為參考,請嘗試遵循以下文檔。

  1. 為 Azure App Service 配置自定義 Linux 容器 要在自定義 docker 映像中安裝gcc工具鏈,方法是更改 Docker 文件,如安裝所述openssh作為Enable SSH部分。
  2. 使用 Docker 從 VS Code 和 Azure 應用服務擴展部署到 Azure

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM