我正在使用Dockerfile和requirements.txt来设置我的azure函数应用程序(遵循this教程)。这是我的Dockerfile这是我的requirements.txt在我使用sudo docker build --tag measurekid/mkserverless:v1.0.0 .构建docker镜像之后,我运行sudo docker run -p 8080:80 -it measurekid/mkserverless:v1.0.0并获得this error。项目结构如下:
|-- 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'。
我尝试使用this troubleshooting guide,但我无法访问项目文件(所有方法都不起作用)。
我是Azure和Azure函数应用的新手,我不知道哪里出了问题。有什么想法吗?任何回应都将不胜感激。
谢谢!
发布于 2020-10-17 00:40:19
根据您的项目结构,您需要从__init__.py更上一层楼才能获得bed-coordinates-detection。在您的项目结构中,名称也是bed-bed-coordinates-detection (床两次,是不是打错了?)。
import sys
sys.path.append("../../bed-coordinates-detection/")
from bed_pipeline import mask_pipeline顺便说一下,这个问题与Azure函数或Docker无关。您可以在本地进行调试,而无需停靠,这很容易揭示问题。
https://stackoverflow.com/questions/64388741
复制相似问题