python-3.x - 无法使用 Python 在 Azure Blob 存储上创建容器
问题描述
我正在尝试在 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
解决方案
推荐阅读
- netsuite - 网络套件。已保存的搜索,如何加入另一个表
- c++ - 从 c 运行 nvidia-smi
- python-3.x - Python 3.7:我想将整个类作为变量传递,如何使用类型提示来指示变量是一个类?
- flutter - 如何获取列表中不重复的值?(飞镖 - 颤振)
- sql - 计算百分比显示只有 100 perc PostgreSQL
- c# - 从 LinkLabel 超链接将文件的副本保存到特定文件夹
- linux - /dev/ttyACM0 访问在 Lubuntu 启动时被拒绝,但在其他任何时间都可以使用
- javascript - hasOwnProperty 使用 Typescript 总是返回 false
- c - 访问指针内的指针数组
- go - 执行闭包 goroutine 未能达到预期结果