python3 安装 BeautifulSoup 提示 Unit tests have failed!

2014-06-08 12:40:36 +08:00
 yakczh
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 "d:\tmp\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 "d:\tmp\BeautifulSoup\setup.py", line 22

print "Unit tests have failed!"

^

SyntaxError: invalid syntax

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in d:\tmp\BeautifulSoup
7529 次点击
所在节点    Python
3 条回复
cbsw
2014-06-08 13:00:35 +08:00
你确定这个库已经支持 python3 了吗? Unit test 明显是 py2 的语法 print "something",而不是 print("something")
lizheming
2014-06-08 13:06:31 +08:00
pip3 install beautifulsoup4

BeautifulSoup是bs3,只支持python2.x的 http://www.crummy.com/software/BeautifulSoup/bs3/documentation.html
Crossin
2014-06-08 14:03:14 +08:00
装bs4

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/116343

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX