我正在编写代码以从 Azure 下载 Blob,但我无法导入BlobClient
.
from azure.storage.blob import BlobClient
cs = "CONNECTION_STRING"
blob = BlobClient.from_connection_string(cs, container="mycontainer", blob="config.ini")
with open("./config.ini", "wb") as my_blob:
blob_data = blob.download_blob()
my_blob.writelines(blob_data.content_as_bytes())
我不断收到以下错误:
$ python3 download.py
Traceback (most recent call last):
File "download.py", line 1, in <module>
from azure.storage.blob import BlobClient
ImportError: cannot import name 'BlobClient'
我正在使用虚拟环境:
pip3 install pylint
python3 -m venv env
pip3 install -r requirements.txt
我的requirements.txt
文件如下所示:
Flask
azure-storage-blob
我的 Python 版本是:
$python3 -V
Python 3.6.8