[英]Azure function app: Dependencies installed but some are not found
我正在使用 Dockerfile 和 requirements.txt 來設置我的 azure 函數應用程序(遵循本教程)。 這是我的Dockerfile ,這是我的requirements.txt 。 在我使用以下sudo docker build --tag measurekid/mkserverless:v1.0.0 .
映像后: sudo docker build --tag measurekid/mkserverless:v1.0.0 .
我運行sudo docker run -p 8080:80 -it measurekid/mkserverless:v1.0.0
我得到這個錯誤。 項目結構如下:
|-- project
|-- serverless #(which is the azure function root)
|-- BedPredict
|-- __init__.py and more
|-- bed-coordinates-detection
|-- bed_pipeline.py (which has the function "mask_pipeline")
在我的__init__.py
文件中,我有以下幾行:
import sys
sys.path.append("../../bed-coordinates-detection/")
from bed_pipeline import mask_pipeline
但是正如您在上面附加的錯誤消息中看到的那樣,我得到ModuleNotFoundError: No module named 'bed_pipeline'
。
我已嘗試遵循此故障排除指南,但無法訪問項目文件(所有方法均無效)。
我對 Azure 和 Azure 函數應用程序非常陌生,我不知道出了什么問題。 有任何想法嗎? 任何回應將不勝感激。
謝謝!
根據您的項目結構,您需要從__init__.py
再上一層以獲得bed-coordinates-detection
。 同樣在您的項目結構中,名稱是bed-bed-coordinates-detection
(床兩次,是不是打字錯誤?)。
import sys
sys.path.append("../../bed-coordinates-detection/")
from bed_pipeline import mask_pipeline
順便說一下,問題與 Azure Function 或 Docker 無關。 您可以在本地進行調試而無需 docker-izing,這很容易發現問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.