简体   繁体   English

如何为 python 安装 azure.storage.blob 库?

[英]How to install azure.storage.blob library for python?

I have issues while importing BlobServiceClient and BlobClient from azure.storage.blob library.从 azure.storage.blob 库导入 BlobServiceClient 和 BlobClient 时遇到问题。 I understood that my issue was related whith a conflict on versions.我知道我的问题与版本冲突有关。 I am able to install the library with pip but then I have the first issue shown (1/).我可以使用 pip 安装库,但随后显示了第一个问题 (1/)。 And when I try to install the library with conda (to manage the versions) I have the second error (2/).当我尝试使用 conda 安装库(以管理版本)时,我遇到了第二个错误 (2/)。

Notes: A) I tried to install/uninstall the library as mentionned in the other questions.注意:A)我尝试安装/卸载其他问题中提到的库。 B) I tried to change the python version, I tested python 3.7, python 3.8 and python 3.10 without any success. B) 我尝试更改 python 版本,我测试了 python 3.7、python 3.8 和 python 3.10,但均未成功。

Thank you very much for your help !非常感谢您的帮助 !

Blandine布兰丁


------------------- 1/ Error message when having installed the librairy with pip ---------------- ------------------ 1/ 使用 pip 安装库时出现错误消息 --------------

C:\WINDOWS\system32>python Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)]:: Anaconda, Inc. on win32 C:\WINDOWS\system32>python Python 3.8.8(默认,2021 年 4 月 13 日,15:08:03)[MSC v.1916 64 位 (AMD64)]:: Anaconda,Inc. on win32

Warning: This Python interpreter is in a conda environment, but the environment has not been activated.警告:这个Python解释器在conda环境下,但是环境还没有激活。 Libraries may fail to load.库可能无法加载。 To activate this environment please see https://conda.io/activation要激活此环境,请参阅https://conda.io/activation

Type "help", "copyright", "credits" or "license" for more information.键入“help”、“copyright”、“credits”或“license”以获得更多信息。

azure-storage-blob Traceback (most recent call last): File "", line 1, in NameError: name 'azure' is not defined from azure.storage.blob import BlobServiceClient Traceback (most recent call last): File "", line 1, in ImportError: cannot import name 'BlobServiceClient' from 'azure.storage.blob' (C:\Users\DBL1DY\Anaconda3\lib\site-packages\azure\storage\blob_ init _.py) azure-storage-blob Traceback(最近一次调用):文件“”,第 1 行,在 NameError 中:name 'azure' is not defined from azure.storage.blob import BlobServiceClient Traceback(最近一次调用 last):文件“”,第 1 行,在 ImportError: cannot import name 'BlobServiceClient' from 'azure.storage.blob' (C:\Users\DBL1DY\Anaconda3\lib\site-packages\azure\storage\blob_ init _.py)


------------------- 2/ Error message when installing the library with conda --------------------- ------------------ 2/ 用conda安装库时报错信息--------------------

(python37) C:\WINDOWS\system32>conda install azure Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. (python37) C:\WINDOWS\system32>conda install azure收集 package 元数据 (current_repodata.json):完成解决环境:初始冻结解决失败。 Retrying with flexible solve.重试灵活解决。 Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.解决环境:使用来自 current_repodata.json 的 repodata 失败,将使用下一个 repodata 源重试。 Collecting package metadata (repodata.json): done Solving environment: failed with initial frozen solve.收集 package 元数据 (repodata.json):完成解决环境:初始冻结解决失败。 Retrying with flexible solve.重试灵活解决。 Solving environment: - Found conflicts.解决环境: - 发现冲突。 Looking for incompatible packages.寻找不兼容的包。 This can take several minutes.这可能需要几分钟时间。 Press CTRL-C to abort.按 CTRL-C 中止。
failed失败的

UnsatisfiableError: The following specifications were found to be incompatible with the existing python installation in your environment: UnsatisfiableError:发现以下规范与您环境中现有的 python 安装不兼容:

Specifications:规格:

  • azure -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0'] azure -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0']

Your python: python=3.7你的 python: python=3.7

If python is on the left-most side of the chain, that's the version you've asked for.如果 python 在链的最左侧,那就是您要求的版本。 When python appears to the right, that indicates that the thing on the left is somehow not available for the python version you are constrained to.当 python 出现在右边时,这表明左边的东西在某种程度上不适用于您被限制的 python 版本。 Note that conda will not change your python version to a different minor version unless you explicitly specify that.请注意,除非您明确指定,否则 conda 不会将您的 python 版本更改为不同的次要版本。

Specifications: • azure -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0'] Your python: python=3.7规格: • azure -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0'] 你的 python: python=3.7

As clearly mentioned in the above error, Python version should be less than 3.7上面错误中明确提到,Python版本应该小于3.7

Please try Python version 3.6 or 3.5 or 2.8 or 2.7请尝试 Python 版本3.63.52.82.7

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Python 和 Azure 函数在 Azure 存储容器中创建 blob - How to create a blob in an Azure Storage Container using Python & Azure Functions 我们如何使用 Python 将文件加载到 Azure Blob 存储或 Azure 数据湖存储? - How can we use Python to load files into Azure Blob Storage or Azure Data Lake Storage? 包括Azure Blob存储库导致Spring出现问题 - Including Azure Blob storage library causes problems in Spring 如何从 azure blob 存储中读取“.owl” - How to read an ".owl" from azure blob storage 如何在 Azure blob 存储中保留空目录? - How to keep empty directories in Azure blob storage? 在 linux 上安装 azure 集成运行时并将数据从 Linux 移动到 Azure blob 存储 - Install azure integration runtime on linux and move data from Linux to Azure blob storage Azure Devops如何部署static angular app到azure blob存储 - Azure Devops how to deploy static angular app to azure blob storage 在 Azure blob 存储上托管时如何使 Angular 路由工作 - How to get Angular routing working when hosting on Azure blob storage 如何使用环境变量为浏览器实现 Microsoft Azure Blob 存储? - How to implement Microsoft Azure Blob storage for browser with environment variables? 如何在只有存储 Blob 数据贡献者角色的 Azure 存储资源管理器中打开存储容器? - How to open Storage Container in Azure Storage Explorer w/ only Storage Blob Data Contributor Role?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM