当前位置:   article > 正文

报错: error: subprocess-exited-with-error

error: subprocess-exited-with-error

报错说明

在cmd下载BeautifulSoup的时候,输入以下命令:

pip install BeautifulSoup
  • 1

出现以下报错:

 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>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

报错翻译

错误:子进程退出,出现错误
×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。
提示:详见上文。
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

猜测原因

版本不兼容

BeautifulSoup目前适用版本是4.x,前面的版本已停止开发

解决方法

  1. 网上查到的,卸载setuptools,重新安装,别的文章有提到,不再赘述
  2. 下载适应版本的第三方库
 pip install BeautifulSoup4
  • 1

结果

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/47038?site
推荐阅读
相关标签
  

闽ICP备14008679号