【Azure 环境】Windows中安装Python azure-eventhub-checkpointstoreblob-aio模块时出错 ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory:

简介: 【Azure 环境】Windows中安装Python azure-eventhub-checkpointstoreblob-aio模块时出错 ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory:

问题描述

在使用Python代码接受EventHub的消息时,根据文档要求安装azure-eventhub-checkpointstoreblob-aio模块时,出现了如下错误:

ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\Users\myaccount\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\azure\eventhub\extensions\checkpointstoreblobaio\_vendor\storage\blob\_generated\aio\operations_async\_append_blob_operations_async.py'

问题原因

因为Python Page模块文件的文件路径太长,如果超过了260个字符这文件不能被创建成功。所以需要解决Windows中对长文件名的限制问题。通过修改注册表中 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem 的LongPathsEnabled 值由0改为1

解决办法

1) 打开 registry editor

 

2)修改HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem 中 LongPathsEnabled值为1

 

 

 

3)重启机器后,再次运行pip install azure-eventhub-checkpointstoreblob-aio即成功安装

PS C:\LBWorkSpace\EventHub\aadeventhubdemo> pip install azure-eventhub-checkpointstoreblob-aio
Requirement already satisfied: azure-eventhub-checkpointstoreblob-aio in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (1.1.1)
Requirement already satisfied: msrest>=0.6.10 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from azure-eventhub-checkpointstoreblob-aio) (0.6.16)
Requirement already satisfied: azure-core<2.0.0,>=1.2.2 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from azure-eventhub-checkpointstoreblob-aio) (1.8.2)
Requirement already satisfied: azure-eventhub<6.0.0,>=5.0.0 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from azure-eventhub-checkpointstoreblob-aio) (5.2.0)
Requirement already satisfied: aiohttp<4.0,>=3.0 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from azure-eventhub-checkpointstoreblob-aio) (3.7.3)
Requirement already satisfied: cryptography>=2.1.4 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from azure-eventhub-checkpointstoreblob-aio) (2.9.2)
Requirement already satisfied: requests-oauthlib>=0.5.0 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from msrest>=0.6.10->azure-eventhub-checkpointstoreblob-aio) (1.3.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from msrest>=0.6.10->azure-eventhub-checkpointstoreblob-aio) (2020.4.5.2)
ache\local-packages\python38\site-packages (from msrest>=0.6.10->azure-eventhub-checkpointstoreblob-aio) (2.24.0)
Requirement already satisfied: isodate>=0.6.0 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from msrest>=0.6.10->azure-eventhub-checkpointstoreblob-aio) (0.6.0)
Requirement already satisfied: six>=1.6 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from azure-core<2.0.0,>=1.2.2->azure-eventhub-checkpointstoreblob-aio) (1.15.0)
Requirement already satisfied: uamqp<2.0,>=1.2.7 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from azure-eventhub<6.0.0,>=5.0.0->azure-eventhub-checkpointstoreblob-aio) (1.2.12)
Requirement already satisfied: multidict<7.0,>=4.5 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from aiohttp<4.0,>=3.0->azure-eventhub-checkpointstoreblob-aio) (5.0.2)
Requirement already satisfied: chardet<4.0,>=2.0 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from aiohttp<4.0,>=3.0->azure-eventhub-checkpointstoreblob-aio) (3.0.4)
Requirement already satisfied: typing-extensions>=3.6.5 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from aiohttp<4.0,>=3.0->azure-eventhub-checkpointstoreblob-aio) (3.7.4.3)
Requirement already satisfied: yarl<2.0,>=1.0 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from aiohttp<4.0,>=3.0->azure-eventhub-checkpointstoreblob-aio) (1.6.3)
Requirement already satisfied: async-timeout<4.0,>=3.0 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from aiohttp<4.0,>=3.0->azure-eventhub-checkpointstoreblob-aio) (3.0.1)
Requirement already satisfied: attrs>=17.3.0 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from aiohttp<4.0,>=3.0->azure-eventhub-checkpointstoreblob-aio) (20.3.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from cryptography>=2.1.4->azure-eventhub-checkpointstoreblob-aio) (1.14.0)
Requirement already satisfied: oauthlib>=3.0.0 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from requests-oauthlib>=0.5.0->msrest>=0.6.10->azure-eventhub-checkpointstoreblob-aio) (3.1.0)   
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from requests~=2.16->msrest>=0.6.10->azure-eventhub-checkpointstoreblob-aio) (1.25.9)
Requirement already satisfied: idna<3,>=2.5 in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from requests~=2.16->msrest>=0.6.10->azure-eventhub-checkpointstoreblob-aio) (2.9)
Requirement already satisfied: pycparser in c:\users\bulu\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from cffi!=1.11.3,>=1.8->cryptography>=2.1.4->azure-eventhub-checkpointstoreblob-aio) (2.20)
WARNING: You are using pip version 20.2.1; however, version 20.2.4 is available.
You should consider upgrading via the 'C:\Users\bulu\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip' command.

 

参考资料:

Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory \METADATA :  https://stackoverflow.com/questions/54778630/could-not-install-packages-due-to-an-environmenterror-errno-2-no-such-file-or

ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: https://www.admindiary.com/os/linux/error-could-not-install-packages-due-to-an-environmenterror-errno-2-no-such-file-or-directory.html

相关文章
|
1月前
|
开发者 Python
Python学习九:file操作
这篇文章是关于Python文件操作的详细教程,包括文件的打开、读写、关闭,以及文件备份脚本的编写和文件定位操作。
20 2
|
1月前
|
JSON 并行计算 数据格式
Python Error 汇总
本文汇总了Python编程中常见的错误及其解决办法,包括导入错误、类型错误、运行时错误等,并提供了详细的解决方案。
105 0
Python Error 汇总
|
1月前
|
存储 安全 Java
Python File处理详解!
本文详细介绍了Python文件处理的方法及其优缺点。通过`open()`、`read()`、`write()`和`append()`等函数,Python能够轻松实现文件的创建、读取、写入及追加等操作。文章还展示了如何使用`tell()`获取文件指针位置,并提供了涵盖文件创建、读取、追加、重命名及删除的完整示例。Python文件处理不仅功能强大且跨平台兼容,但也存在易错性、安全风险及处理大文件时的性能问题。适合数据存储、配置管理和数据分析等多种应用场景。
38 4
|
1月前
|
并行计算 Python
Python错误笔记(一):CUDA initialization: CUDA unknown error - this may be due to an incorrectly set up env
这篇文章讨论了CUDA初始化时出现的未知错误及其解决方案,包括重启系统和安装nvidia-modprobe。
134 0
|
1月前
|
资源调度 编译器 Linux
Windows10系统安装Truffle框架,安装失败,提示:error An unexpected error occurred: “https://xxxxx
Windows10系统安装Truffle框架,安装失败,提示:error An unexpected error occurred: “https://xxxxx
76 0
|
2月前
|
缓存 Python
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-npf9报错
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-npf9报错
|
3月前
|
PHP Windows
【Azure App Service for Windows】 PHP应用出现500 : The page cannot be displayed because an internal server error has occurred. 错误
【Azure App Service for Windows】 PHP应用出现500 : The page cannot be displayed because an internal server error has occurred. 错误
|
3月前
|
缓存 NoSQL 网络安全
【Azure Redis 缓存】 Python连接Azure Redis, 使用redis.ConnectionPool 出现 "ConnectionResetError: [Errno 104] Connection reset by peer"
【Azure Redis 缓存】 Python连接Azure Redis, 使用redis.ConnectionPool 出现 "ConnectionResetError: [Errno 104] Connection reset by peer"
|
5天前
|
监控 安全 网络安全
Windows Server管理:配置与管理技巧
Windows Server管理:配置与管理技巧
24 3
|
9天前
|
存储 安全 网络安全
Windows Server 本地安全策略
由于广泛使用及历史上存在的漏洞,Windows服务器成为黑客和恶意行为者的主要攻击目标。这些系统通常存储敏感数据并支持关键服务,因此组织需优先缓解风险,保障业务的完整性和连续性。常见的威胁包括勒索软件、拒绝服务攻击、内部威胁、恶意软件感染等。本地安全策略是Windows操作系统中用于管理计算机本地安全性设置的工具,主要包括用户账户策略、安全选项、安全设置等。实施强大的安全措施,如定期补丁更新、网络分段、入侵检测系统、数据加密等,对于加固Windows服务器至关重要。