使用Pip安装ChatterBot时遭遇legacy-install-failure错误
解决ChatterBot安装时preshed包的legacy-install-failure错误
错误详情
执行pip install ChatterBot时触发如下错误:
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failureEncountered error while trying to install package.
preshed
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
[end of output]
该错误源于preshed包的编译安装失败,属于legacy-install-failure类型,和pip本身无关。
可行解决步骤
- 安装系统编译依赖:
- Windows:安装Microsoft Visual C++ Build Tools,勾选「Desktop development with C++」组件完成安装
- Debian/Ubuntu系Linux:执行
sudo apt-get install python3-dev build-essential - macOS:执行
xcode-select --install安装Xcode命令行工具
- 升级pip及相关工具:
pip install --upgrade pip setuptools wheel - 指定兼容版本安装preshed后再装ChatterBot:
pip install preshed==3.0.2 pip install ChatterBot - 若上述方法无效,可尝试用conda安装:
conda install -c conda-forge chatterbot
内容的提问来源于stack exchange,提问作者timme
相关产品推荐
相关产品推荐

