Windows10下安装pyppeteer-ghost-cursor==0.2.3失败求助
解决Windows10下安装pyppeteer-ghost-cursor==0.2.3时的bezier依赖安装错误
问题描述
执行命令 pip install pyppeteer-ghost-cursor==0.2.3 安装包时出现错误,报错信息如下:
Collecting pyppeteer-ghost-cursor==0.2.3 Using cached pyppeteer_ghost_cursor-0.2.3-py3-none-any.whl (21 kB) Collecting bezier Using cached bezier-2021.2.12.tar.gz (313 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [1 lines of output] The BEZIER_INSTALL_PREFIX environment variable must be set. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details.
使用Windows10系统,如何解决该安装问题?
解决方法
错误根源是旧版本bezier(2021.2.12)需要手动指定环境变量,以下是三种可行解决方案:
方案一:临时设置环境变量后安装
- 打开命令提示符(CMD)或PowerShell
- 设置环境变量:
- CMD环境:
(将set BEZIER_INSTALL_PREFIX=C:\PythonXX\Lib\site-packagesPythonXX替换为你的实际Python版本,比如Python39,也可直接使用.表示当前目录) - PowerShell环境:
$env:BEZIER_INSTALL_PREFIX = "C:\PythonXX\Lib\site-packages"
- CMD环境:
- 执行安装命令:
pip install pyppeteer-ghost-cursor==0.2.3
方案二:先升级bezier再安装目标包
新版本bezier已修复该环境变量要求,且兼容pyppeteer-ghost-cursor==0.2.3:
- 安装最新版bezier:
pip install bezier --upgrade - 安装目标包:
pip install pyppeteer-ghost-cursor==0.2.3
方案三:使用虚拟环境(推荐)
避免全局环境依赖冲突,创建虚拟环境后操作:
- 创建并激活虚拟环境:
python -m venv venv venv\Scripts\activate - 选择上述任意一种方案完成安装
内容的提问来源于stack exchange,提问作者user19419589
相关产品推荐
相关产品推荐

