python - "unit tests have failed"for beautifulsoup

标签 python python-3.x beautifulsoup

我正在尝试为 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 不兼容。安装beautifulsoup4而是:

pip install beautifulsoup4

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

关于python - "unit tests have failed"for beautifulsoup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22301307/

相关文章:

python - 获取 tensorflow 中dynamic_rnn的最后输出?

python - 元组列表的列表,按第一个元素分组并添加第二个元素

python - Django-registration and ReCaptcha integration - 如何传递用户的IP

Python 导入 BeautifulSoup 不起作用

python - 使用 BeautifulSoup 导航

python - ImageDraw.draw.line(): SystemError: new style getargs format but argument is not a tuple

python - 在 python 中使用 ElementTree 进行 XML 解析时检查子级是否存在

python - 当 __init__.py 破坏 pyinstaller 时如何正确导入文件

python - 如何使用马尔可夫链获得所有可能性?

python - 使用 Python mechanize 循环下载文件