【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

相关文章
|
16天前
|
计算机视觉 Windows Python
windows下使用python + opencv读取含有中文路径的图片 和 把图片数据保存到含有中文的路径下
在Windows系统中,直接使用`cv2.imread()`和`cv2.imwrite()`处理含中文路径的图像文件时会遇到问题。读取时会返回空数据,保存时则无法正确保存至目标目录。为解决这些问题,可以使用`cv2.imdecode()`结合`np.fromfile()`来读取图像,并使用`cv2.imencode()`结合`tofile()`方法来保存图像至含中文的路径。这种方法有效避免了路径编码问题,确保图像处理流程顺畅进行。
102 1
|
2天前
|
SQL JavaScript 数据库
sqlite在Windows环境下安装、使用、node.js连接
sqlite在Windows环境下安装、使用、node.js连接
|
20天前
|
Java 应用服务中间件 Windows
【App Service for Windows】为 App Service 配置自定义 Tomcat 环境
【App Service for Windows】为 App Service 配置自定义 Tomcat 环境
|
20天前
|
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. 错误
|
4天前
|
Linux 开发者 Python
从Windows到Linux,Python系统调用如何让代码飞翔🚀
【9月更文挑战第10天】在编程领域,跨越不同操作系统的障碍是常见挑战。Python凭借其“编写一次,到处运行”的理念,显著简化了这一过程。通过os、subprocess、shutil等标准库模块,Python提供了统一的接口,自动处理底层差异,使代码在Windows和Linux上无缝运行。例如,`open`函数在不同系统中以相同方式操作文件,而`subprocess`模块则能一致地执行系统命令。此外,第三方库如psutil进一步增强了跨平台能力,使开发者能够轻松编写高效且易维护的代码。借助Python的强大系统调用功能,跨平台编程变得简单高效。
11 0
|
17天前
|
Windows
Windows 10找不到恢复环境
Windows 10找不到恢复环境
16 0
|
20天前
|
网络安全 API 数据安全/隐私保护
【Azure App Service】.NET代码实验App Service应用中获取TLS/SSL 证书 (App Service Windows)
【Azure App Service】.NET代码实验App Service应用中获取TLS/SSL 证书 (App Service Windows)
|
20天前
|
Shell PHP Windows
【Azure App Service】Web Job 报错 UNC paths are not supported. Defaulting to Windows directory.
【Azure App Service】Web Job 报错 UNC paths are not supported. Defaulting to Windows directory.
|
20天前
|
存储 Linux Windows
【应用服务 App Service】App Service For Windows 如何挂载Storage Account File Share 示例
【应用服务 App Service】App Service For Windows 如何挂载Storage Account File Share 示例