报错说明
在cmd下载BeautifulSoup的时候,输入以下命令:
pip install BeautifulSoup
出现以下报错:
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [7 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\Administrator\AppData\Local\Temp\pip-install-pgs6hik1\beautifulsoup_06fde544331044f484b06f853e2c9761\setup.py", line 3
"You're trying to run a very old release of Beautiful Soup under Python 3. This will not work."<>"Please use Beautiful Soup 4, available through the pip package 'beautifulsoup4'."
^
SyntaxError: invalid syntax
[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.
C:\Users\Administrator\AppData\Local\Programs\Python\Python38>
报错翻译
错误:子进程退出,出现错误
×python setup.py egg_info未成功运行。
│ 退出代码:1
╰─> [7行输出]
回溯(最近一次调用):
文件“<string>”,第2行,在<module>中
文件“<pip setuptools caller>”,第34行,在<module>中
文件“C:\Users\Administrator\AppData\Local\Temp\pip-install-pgs6hik1\beautuloup_06fde544331044f484b06f853e2c9761\setup.py”,第3行
“您正在尝试在Python 3下运行一个非常旧的Beautiful Soup版本。这行不通。“<>”请使用Beautiful Soup 4,可通过pip包“Beautiful oup4”获得。"
^
语法错误:无效语法
[输出结束]
注意:此错误源自子流程,可能不是pip的问题。
错误:元数据生成失败
×生成包元数据时遇到错误。
╰─> 输出见上文。
注意:这是上面提到的包的问题,而不是pip。
提示:详见上文。
猜测原因
版本不兼容文章来源:https://www.toymoban.com/news/detail-515065.html
BeautifulSoup目前适用版本是4.x,前面的版本已停止开发文章来源地址https://www.toymoban.com/news/detail-515065.html
解决方法
- 网上查到的,卸载setuptools,重新安装,别的文章有提到,不再赘述
- 下载适应版本的第三方库
pip install BeautifulSoup4
结果
Collecting beautifulsoup4
Downloading beautifulsoup4-4.11.1-py3-none-any.whl (128 kB)
---------------------------------------- 128.2/128.2 kB 137.1 kB/s eta 0:00:00
Collecting soupsieve>1.2
Downloading soupsieve-2.3.2.post1-py3-none-any.whl (37 kB)
Installing collected packages: soupsieve, beautifulsoup4
Successfully installed beautifulsoup4-4.11.1 soupsieve-2.3.2.post1
到了这里,关于报错: error: subprocess-exited-with-error的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!