我得到这个奇怪的消息,即使我已经安装通过皮普
Worker failed to function id 2c284181-1e21-4200-b5ea-b7d226696206.
[2023-11-30T03:24:02.694Z] Result: Failure
[2023-11-30T03:24:02.694Z] Exception: ImportError: Error importing numpy: you should not try to import numpy from
[2023-11-30T03:24:02.694Z] its source directory; please exit the numpy source tree, and relaunch
[2023-11-30T03:24:02.694Z] your python interpreter from there. Troubleshooting Guide: https://aka.ms/functions-modulenotfound
[2023-11-30T03:24:02.695Z] Stack: File "/usr/local/lib/node_modules/azure-functions-core-tools/bin/workers/python/3.9/OSX/X64/azure_functions_worker/dispatcher.py", line 314, in _handle__function_load_request
[2023-11-30T03:24:02.695Z] func = loader.load_function(
[2023-11-30T03:24:02.695Z] File "/usr/local/lib/node_modules/azure-functions-core-tools/bin/workers/python/3.9/OSX/X64/azure_functions_worker/utils/wrappers.py", line 42, in call
[2023-11-30T03:24:02.695Z] raise extend_exception_message(e, message)
[2023-11-30T03:24:02.695Z] File "/usr/local/lib/node_modules/azure-functions-core-tools/bin/workers/python/3.9/OSX/X64/azure_functions_worker/utils/wrappers.py", line 40, in call
[2023-11-30T03:24:02.695Z] return func(*args, **kwargs)
[2023-11-30T03:24:02.695Z] File "/usr/local/lib/node_modules/azure-functions-core-tools/bin/workers/python/3.9/OSX/X64/azure_functions_worker/loader.py", line 85, in load_function
[2023-11-30T03:24:02.695Z] mod = importlib.import_module(fullmodname)
[2023-11-30T03:24:02.695Z] File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
[2023-11-30T03:24:02.695Z] return _bootstrap._gcd_import(name[level:], package, level)
[2023-11-30T03:24:02.695Z] File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
[2023-11-30T03:24:02.695Z] File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
[2023-11-30T03:24:02.695Z] File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
[2023-11-30T03:24:02.696Z] File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
[2023-11-30T03:24:02.696Z] File "<frozen importlib._bootstrap_external>", line 850, in exec_module
[2023-11-30T03:24:02.696Z] File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
[2023-11-30T03:24:02.696Z] File "/Users/zero/Documents/Github/project/fc/__init__.py", line 7, in <module>
[2023-11-30T03:24:02.696Z] import numpy as np
[2023-11-30T03:24:02.696Z] File "/Users/zero/Library/Python/3.9/lib/python/site-packages/numpy/__init__.py", line 135, in <module>
[2023-11-30T03:24:02.696Z] raise ImportError(msg) from e
字符串
初始化.py
import os
import re
import logging
from pathlib import Path
import numpy as np
import azure.functions as func
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('A function processed a request.')
return func.HttpResponse(
"success",
status_code=200,
)
型
requirements.txt
numpy
型
的数据
1条答案
按热度按时间n53p2ov01#
该错误可能是由于NumPy包安装不正确造成的。
要解决此问题,请执行以下操作:
Python: Select Interpreter
)。字符串
我使用***Python版本3.11.6***创建了一个简单的Python Azure函数,并导入了***NumPy***Package。
验证码:
型
requirements.txt:
型
型
pip install -r requirements.txt
安装所需的软件包:x1c 0d1x的数据
的
输出:
的
的
参考资料:
Troubleshooting — NumPy v1.26 Manual