python - Databricks:没有名为 azure.storage 的模块

标签 python azure databricks azure-databricks fileshare

我正在关注这个问题的答案Load file from Azure Files to Azure Databricks使用以下代码创建 SAS token

# Create a client of Azure File Service as same as yours
from azure.storage.file import FileService

account_name = '<your account name>'
account_key = '<your account key>'
share_name = 'test'
directory_name = None
file_name = 'test.xlsx'

file_service = FileService(account_name=account_name, account_key=account_key)

但我收到错误:

ModuleNotFoundError: No module named 'azure.storage'

我已经使用这些命令安装了模块

!pip install azure
!pip install azure-storage
!pip install azure-storage-file

我在集群中安装了相同的模块,如标题所示 enter image description here

之前的尝试都无法修复我的“ModuleNotFoundError:没有名为“azure.storage”的模块”

enter image description here 有没有人有办法解决这个问题?

最佳答案

此类位于另一个包中:azure.storage.file.fileservice ( doc ),因此您需要编写:

from azure.storage.file.fileservice import FileService

关于python - Databricks:没有名为 azure.storage 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73380200/

相关文章:

python - 在 Python 中正确使用 super——我应该明确引用类名吗?

python - 在 sqlalchemy select 对象中测试 where 子句

pyspark - 在 Spark 作业中获取 Databricks 集群 ID(或获取集群链接)

Python BeautifulSoup,遍历标签和属性

python - pytest 如何以及在哪里找到固定装置

azure - 发送到 Azure 通知中心的通知消息未到达设备 (Android)

node.js - Azure Webjob System.IO.PathTooLongException

rest - 文档数据库 : Can't access documents in my collection

r - DataBricks 中将 R 数据帧转换为 Spark 数据帧是否有大小限制?

python - 我们可以在 Databricks 工作区中存储 .whl 文件吗?