spa*_*arc 3 python ansi utf-8 python-import azure-blob-storage
我正在尝试将 Azure blob 容器中的文本文件从 ANSI 编码转换为 UTF-8 编码,而不使用 python 将文件下载到本地。当我尝试在 Python 代码中导入BlockBlobService来处理 Azure Blob 存储时,出现以下错误。我相信我已经安装了正确的 python 模块,但可能还缺少一些我不知道的其他模块,或者可能是“没有正确的 python 模块版本”。“pip list”命令在我的虚拟机上显示以下内容。对此有任何帮助都会很好。
pip list 包 版本
azure-common 1.1.25
azure-core 1.4.0
azure-nspkg 3.0.2
azure-storage 0.36.0
azure-storage-blob 12.3.0
azure-storage-common 2.1.0
azure-storage-nspkg 3.1.0
bcrypt 3.1.7
certifi 2020.4.5.1
cffi 1.14.0
chardet 3.0.4
cryptography 2.9
idna 2.9
isodate 0.6.0
msrest 0.6.13
oauthlib 3.1.0
paramiko 2.7.1
pip 20.0.2
pycparser 2.20
PyNaCl 1.3.0
python-dateutil 2.8.1
requests 2.23.0
requests-oauthlib 1.3.0
setuptools 41.2.0
six 1.14.0
urllib3 1.25.8
wheel 0.34.2
Run Code Online (Sandbox Code Playgroud)
小智 11
Azure-storage-blob,版本:12.3.0 是最新版本,其中包含 BlobServiceClient 而不是 BlockBlobService,因此如果要使用 BlockBlobService,必须将 azure-storage-blob 版本指定为 2.1.0。做就是了
pip install azure-storage-blob==2.1.0
Run Code Online (Sandbox Code Playgroud)
这可以解决你的问题。