ModuleNotFoundError: No module named 'x" using azure functions + Python + private repository

ModuleNotFoundError: No module named 'x" using azure functions + Python + private repository

我在使用 python 的 azure 函数上遇到 ModuleNotFoundError 错误。 我想从我的 HttpTrigger init.py 中的私有存储库调用一个函数。私有存储库的实际文件存储在 运行:

之后的 src 文件夹中

pip install -r --target=".python_packages/lib/site-packages" requirements.txt

.python_packages里面的private_repostiroy.egg.link包含这个值:

/home/runner/work/etl_azure_function/etl_azure_function/src/private-repository

我尝试了多种解决方案来从私有 git 存储库导入,例如:

from ..src import private_repository.package
from ..src.private_repository.package import funtion
import private_repository.function 

我总是遇到找不到模块的错误,尽管它已通过 Github 操作成功部署。 如何将私有存储库中的函数导入 httptrigger

<project_root>/
 | - requirements.txt
 | - .venv/
 | - .vscode/
 | - .python_packages
 | - HttpTrigger/
 | | - __init__.py
 | | - function.json
 | | - example.py
 | - src
 | | - private_git_repo
 | | | - package 
 | | | |  __init__.py
 | | | |  function.py

我通过删除 requirements.txt:

中的可编辑选项 (-e) 解决了这个问题