当前位置: 代码迷 >> python >> 对于beautifulsoup,“单元测试失败了”
  详细解决方案

对于beautifulsoup,“单元测试失败了”

热度:65   发布时间:2023-07-14 08:58:26.0

我正在尝试为python33安装beautifulsoup但它没有正确安装它给出了错误:

C:\Python33>pip install beautifulsoup
Downloading/unpacking beautifulsoup
Downloading BeautifulSoup-3.2.1.tar.gz
Running setup.py egg_info for package beautifulsoup
Traceback (most recent call last):
  File "<string>", line 16, in <module>
  File "c:\windows\temp\pip_build_Prashant\beautifulsoup\setup.py", line 22
    print "Unit tests have failed!"
                                  ^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "<string>", line 16, in <module>

File "c:\windows\temp\pip_build_Prashant\beautifulsoup\setup.py", line 22

print "Unit tests have failed!"

                              ^

SyntaxError: invalid syntax 

那么我能为这个错误做些什么,有人能建议我吗?

您正在尝试安装BeautifulSoup 3,它不兼容Python 3。 安装代替:

pip install beautifulsoup4

大多数假设BeautifulSoup 3的代码也适用于BeautifulSoup 4.对于新项目,只需坚持使用BS4。

  相关解决方案