首页 > 解决方案 > 如何修复“ModuleNotFoundError:没有名为 'azure.storage'\r 的模块”

问题描述

尝试在 azure windows 服务器上运行项目时出现此错误,但它在 Ubuntu 机器和我的本地 Windows 机器上运行良好。我已经使用 mod_wsgi 服务器在 Apache 上部署了烧瓶项目。我已经安装了所有必需的依赖项。

套餐

[Thu Feb 18 09:03:58.636970 2021] [wsgi:error] [pid 5724:tid 1120] [client 110.225.67.165:26675] mod_wsgi (pid=5724): Failed to exec Python script file 'C:/Users/user/Desktop/flask/app/src/app.wsgi'.
[Thu Feb 18 09:03:58.636970 2021] [wsgi:error] [pid 5724:tid 1120] [client 110.225.67.165:26675] mod_wsgi (pid=5724): Exception occurred processing WSGI script 'C:/Users/user/Desktop/flask/app/src/app.wsgi'.
[Thu Feb 18 09:03:58.636970 2021] [wsgi:error] [pid 5724:tid 1120] [client 110.225.67.165:26675] Traceback (most recent call last):\r
[Thu Feb 18 09:03:58.636970 2021] [wsgi:error] [pid 5724:tid 1120] [client 110.225.67.165:26675]   File "C:/Users/user/Desktop/flask/app/src/app.wsgi", line 4, in <module>\r
[Thu Feb 18 09:03:58.636970 2021] [wsgi:error] [pid 5724:tid 1120] [client 110.225.67.165:26675]     from wsgi import app as application\r
[Thu Feb 18 09:03:58.636970 2021] [wsgi:error] [pid 5724:tid 1120] [client 110.225.67.165:26675]   File "C:\\Users\\user\\Desktop\\flask\\app\\src\\wsgi.py", line 6, in <module>\r
[Thu Feb 18 09:03:58.636970 2021] [wsgi:error] [pid 5724:tid 1120] [client 110.225.67.165:26675]     from server import app\r
[Thu Feb 18 09:03:58.636970 2021] [wsgi:error] [pid 5724:tid 1120] [client 110.225.67.165:26675]   File "C:\\Users\\user\\Desktop\\flask\\app\\src\\server.py", line 10, in <module>\r
[Thu Feb 18 09:03:58.636970 2021] [wsgi:error] [pid 5724:tid 1120] [client 110.225.67.165:26675]     from azure_portal.blob_storage import BlobStorage\r
[Thu Feb 18 09:03:58.636970 2021] [wsgi:error] [pid 5724:tid 1120] [client 110.225.67.165:26675]   File "C:\\Users\\user\\Desktop\\flask\\app\\src\\azure_portal\\blob_storage.py", line 5, in <module>\r
[Thu Feb 18 09:03:58.636970 2021] [wsgi:error] [pid 5724:tid 1120] [client 110.225.67.165:26675]     from azure.storage.blob import BlobServiceClient\r
[Thu Feb 18 09:03:58.636970 2021] [wsgi:error] [pid 5724:tid 1120] [client 110.225.67.165:26675] ModuleNotFoundError: No module named 'azure.storage'\r

请帮我解决问题。这对我很有帮助。

标签: pythonazureapacheflaskazure-blob-storage

解决方案


你确定azure.storage机器上安装了?

在运行项目之前安装它

script: pip install azure-storage

尝试pip list查看您的机器上安装了哪些模块。

另外,请注意,您的代码使用的版本已安装在您的机器上。


推荐阅读