報錯說明
在cmd下載BeautifulSoup的時候,輸入以下命令:
pip install BeautifulSoup
出現(xiàn)以下報錯:
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>
報錯翻譯
錯誤:子進(jìn)程退出,出現(xiàn)錯誤
×python setup.py egg_info未成功運(yùn)行。
│ 退出代碼:1
╰─> [7行輸出]
回溯(最近一次調(diào)用):
文件“<string>”,第2行,在<module>中
文件“<pip setuptools caller>”,第34行,在<module>中
文件“C:\Users\Administrator\AppData\Local\Temp\pip-install-pgs6hik1\beautuloup_06fde544331044f484b06f853e2c9761\setup.py”,第3行
“您正在嘗試在Python 3下運(yùn)行一個非常舊的Beautiful Soup版本。這行不通?!?span id="n5n3t3z" class="token operator"><>”請使用Beautiful Soup 4,可通過pip包“Beautiful oup4”獲得。"
^
語法錯誤:無效語法
[輸出結(jié)束]
注意:此錯誤源自子流程,可能不是pip的問題。
錯誤:元數(shù)據(jù)生成失敗
×生成包元數(shù)據(jù)時遇到錯誤。
╰─> 輸出見上文。
注意:這是上面提到的包的問題,而不是pip。
提示:詳見上文。
猜測原因
版本不兼容文章來源:http://www.zghlxwxcb.cn/news/detail-515065.html
BeautifulSoup目前適用版本是4.x,前面的版本已停止開發(fā)文章來源地址http://www.zghlxwxcb.cn/news/detail-515065.html
解決方法
- 網(wǎng)上查到的,卸載setuptools,重新安裝,別的文章有提到,不再贅述
- 下載適應(yīng)版本的第三方庫
pip install BeautifulSoup4
結(jié)果
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
到了這里,關(guān)于報錯: error: subprocess-exited-with-error的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!