在當前設定下使用 Azure Devops 任務:
task: AzureFunctionApp@1
displayName: Deploy Lab
inputs:
azureSubscription: 'serviceConnection'
appType: 'functionAppLinux'
appName: 'myAwesomeApp'
package: '.'
runtimeStack: 'PYTHON|3.8'
另外,在根目錄中(即.在 ado 任務中),我有一個 requirements.txt 檔案,其中包含numpy
部署成功運行,但是當我測驗應用程式時,出現以下錯誤:
失敗例外:ModuleNotFoundError:沒有名為“numpy”的模塊
這僅僅意味著沒有考慮 requirements.txt 檔案或 pip install -r requirements.txt 沒有在遠程計算中成功運行,我做錯了什么?
編輯:添加了一個在本地安裝軟體包的步驟確實有效,但是由于 numpy 是一個 C 構建的庫,它依賴于主機并且在遠程功能應用程式中不起作用:lol:
我添加的步驟是這個:
- bash: pip install -r requirements.txt --target="./.python_packages/lib/site-packages"
displayName: 'Install dependencies'
和錯誤:
Result: Failure Exception: ImportError: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed. We have compiled some common reasons and troubleshooting tips at: https://numpy.org/devdocs/user/troubleshooting-importerror.html Please note and check the following: * The Python version is: Python3.9 from "/usr/local/bin/python" * The NumPy version is: "1.22.3" and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help. Original error was: No module named 'numpy.core._multiarray_umath' . Troubleshooting Guide: https://aka.ms/functions-modulenotfound Stack: File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py", line 305, in _handle__function_load_request func = loader.load_function( File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 42, in call raise extend_exception_message(e, message) File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 40, in call return func(*args, **kwargs) File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/loader.py", line 85, in load_function mod = importlib.import_module(fullmodname) File "/usr/local/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "/home/site/wwwroot/bilans/main.py", line 24, in from . import bilan File "/home/site/wwwroot/bilans/bilan.py", line 16, in import numpy as np File "/home/site/wwwroot/.python_packages/lib/site-packages/numpy/init.py", line 144, in from . import core File "/home/site/wwwroot/.python_packages/lib/site-packages/numpy/core/init.py", line 49, in raise ImportError(msg)
uj5u.com熱心網友回復:
也許您將不得不在管道中使用 python 3.9 和最新的 ubuntu 代理
https://github.com/Azure/azure-functions-python-worker/issues/904
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/446795.html
標籤:Python 天蓝色 天蓝色的devops 天蓝色函数
下一篇:集成了azurite的VisualStudio2022(v3.14.1)在創建本地blob容器時會給出錯誤訊息InvalidHeaderValue
