Python3.11安装pyautogui时构建依赖安装错误求助
问题:安装pyautogui失败,构建依赖阶段出错
环境信息
- Python版本:3.11
- pip版本:23.3.1
- setuptools版本:68.2.2
已尝试的安装命令
pip install pywinauto --proxy=http://dummyproxy1.hella.com:2584 pip install pyautogui -i https://pypi.org/simple --proxy=http://dummyproxy.hella.com:7894 pip install --proxy=http://dummyproxy.hella.com:8785 pyautogui
错误详情
包已成功下载,但安装构建依赖时报错,核心错误信息如下:
PS C:\dev\git_repo\projects\megamax_test_automation_chrome> pip install --proxy=http://dummyproxy.hella.com:7896 pyautogui Collecting pyautogui Using cached PyAutoGUI-0.9.54.tar.gz (61 kB) Installing build dependencies ... error error: subprocess-exited-with-error × pip subprocess to install build dependencies did not run successfully. │ exit code: 1 ╰─> [7 lines of output] WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConne ction object at 0x000002365438DD10>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConne ction object at 0x0000023654239AD0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConne ction object at 0x000002365438FB90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConne ction object at 0x000002365437E790>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConne ction object at 0x000002365437DF50>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/ ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none) ERROR: No matching distribution found for setuptools>=40.8.0 [end of output]
提示错误源自subprocess:
error: subprocess-exited-with-error × pip subprocess to install build dependencies did not run successfully. │ exit code: 1 ╰─> See above for output.
解决方案
方案1:使用--no-build-isolation参数
当前环境已安装的setuptools版本(68.2.2)远高于要求的>=40.8.0,直接跳过构建隔离环境,使用现有依赖安装:
pip install --proxy=http://dummyproxy.hella.com:7894 pyautogui --no-build-isolation
方案2:先单独安装构建依赖,再安装pyautogui
确保构建依赖通过代理正常安装后,再执行pyautogui的安装:
pip install --proxy=http://dummyproxy.hella.com:7894 setuptools wheel pip install --proxy=http://dummyproxy.hella.com:7894 pyautogui
方案3:本地安装预编译wheel包
下载对应Python3.11的pyautogui wheel包(.whl格式)到本地,直接执行本地安装:
pip install path/to/PyAutoGUI-0.9.54-py3-none-any.whl
内容的提问来源于stack exchange,提问作者prashant agrawal
相关产品推荐
相关产品推荐

