【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

相关文章
|
7天前
|
JSON API 数据格式
30天拿下Python之requests模块
30天拿下Python之requests模块
18 7
|
7天前
|
人工智能 数据可视化 搜索推荐
Python异常模块与包
Python异常模块与包
|
6天前
|
Linux Python Windows
一个Python模块Pendulum的问题
一个Python模块Pendulum的问题
12 0
|
7天前
|
API Python
30天拿下Python之matplotlib模块
30天拿下Python之matplotlib模块
|
5月前
|
Linux iOS开发 MacOS
Windows系统下安装Python的步骤
Windows系统下安装Python的步骤
69 0
|
5月前
|
JSON TensorFlow 算法框架/工具
Windows下安装Anaconda5.3.1+Python3.8+TensorFlow2.13.0-CPU版本总结
Windows下安装Anaconda5.3.1+Python3.8+TensorFlow2.13.0-CPU版本总结
370 0
|
11月前
|
IDE 测试技术 开发工具
软件测试|最详细的Windows安装Python教程
软件测试|最详细的Windows安装Python教程
1481 0
|
机器学习/深度学习 IDE 开发工具
软件类配置(二)【Windows中安装python、pycharm、opencv、anaconda】
软件类配置(二)【Windows中安装python、pycharm、opencv、anaconda】
132 0
|
数据安全/隐私保护 iOS开发 MacOS
001 如何在 Windows 10 和 Mac 上安装 Python3?
001 如何在 Windows 10 和 Mac 上安装 Python3?
151 0
001 如何在 Windows 10 和 Mac 上安装 Python3?
|
Linux 计算机视觉 Python
Windows下使用Pycharm安装python GUI库Kivy教程
Windows下使用Pycharm安装python GUI库Kivy教程
710 0
Windows下使用Pycharm安装python GUI库Kivy教程
下一篇
无影云桌面