我正在尝试为 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/