Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
未解析的导入';azure.storage.blob';尝试使用Python库azure存储blob时_Python_Azure_Azure Storage Blobs - Fatal编程技术网

未解析的导入';azure.storage.blob';尝试使用Python库azure存储blob时

未解析的导入';azure.storage.blob';尝试使用Python库azure存储blob时,python,azure,azure-storage-blobs,Python,Azure,Azure Storage Blobs,以此URL为例: 我正在尝试使用Python库azure storage blob来提取blob中存储的文件的文件名。我已经使用conda安装了所有必需的软件包,如下所示,因为我正在anaconda中使用虚拟环境 conda安装-c anaconda azure conda安装-c conda forge azure存储blob conda安装-c conda forge azure nspkg 但我的代码无法编译,错误消息为未解析导入“azure.storage.blob” 我还有一个错误:

以此URL为例:

我正在尝试使用Python库azure storage blob来提取blob中存储的文件的文件名。我已经使用conda安装了所有必需的软件包,如下所示,因为我正在anaconda中使用虚拟环境

conda安装-c anaconda azure conda安装-c conda forge azure存储blob conda安装-c conda forge azure nspkg

但我的代码无法编译,错误消息为未解析导入“azure.storage.blob” 我还有一个错误: ModuleNotFoundError:没有名为“azure”的模块

但是,我已经安装了这些软件包。你能告诉我如何解决这个问题吗

这是我的密码:

    import os, uuid
from azure.storage.blob import BlobClient, BlobServiceClient, ContainerClient, __version__

try:
    print("Azure Blob Storage v" + __version__ + " - Python sample")
except Exception as ex:
    print('Exception:')
    print(ex)

# Retrieve the connection string for use with the application. The storage
# connection string is stored in an environment variable on the machine
# running the application called AZURE_STORAGE_CONNECTION_STRING. If the environment variable is
# created after the application is launched in a console or with Visual Studio,
# the shell or application needs to be closed and reloaded to take the
# environment variable into account.
connect_str = os.getenv('AZURE_STORAGE_CONNECTION_STRING')

# Create BlobServiceClient object
blob_service_client = BlobServiceClient.from_connection_string(connect_str)

containers_list = blob_service_client.list_containers

print(containers_list)


我发现使用visual studio代码,这并不是一个真正的错误。正如,当我尝试使用命令python运行时,我的脚本实际执行了。因此,安装这些软件包就足以使用这些库: conda安装-c anaconda azure conda安装-c conda forge azure存储blob