无法使用Python在Azure Blob存储上创建容器

时间:2020-06-27 16:01:43

标签: python-3.x azure azure-blob-storage

我正在尝试在Azure Blob存储中创建一个容器。这是代码段-

from azure.storage.blob import BlobServiceClient

import uuid

connect_str = 'xxxxxx'

#create a container
blob_service_client = BlobServiceClient.from_connection_string(connect_str)
container_name = "quickstart" + str(uuid.uuid4())
container_client = blob_service_client.create_container(container_name)

我收到以下错误-

ImportError: No module named 'azure.storage'; 'azure' is not a package

我已经安装了azure-storage-blob软件包。我在做什么错了?

* python -m pip show azure-storage-blob *的输出是-

(venv) C:\Users\riz\PycharmProjects\azure_blob_extract>python -m pip show azure-storage-blob
Name: azure-storage-blob
Version: 12.3.2
Summary: Microsoft Azure Blob Storage Client Library for Python
Home-page: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/storage/azure-storage-blob
Author: Microsoft Corporation
Author-email: ascl@microsoft.com
License: MIT License
Location: c:\users\riz\pycharmprojects\azure_blob_extract\venv\lib\site-packages
Requires: cryptography, msrest, azure-core
Required-by:

python --version *的输出是-

Python 3.7.4

当我尝试从Windows CMD运行代码时,出现此错误-

azure.core.exceptions.ServiceRequestError: ("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])",)

当我从PyCharm IDE运行代码时,出现此错误-

azure.core.exceptions.ServiceRequestError: <urllib3.connection.HTTPSConnection object at 0x000001EEA3C9AC88>: Failed to establish a new connection: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions

0 个答案:

没有答案