安装 BeautifulSoup [英] install BeautifulSoup

查看:17
本文介绍了安装 BeautifulSoup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 ubuntu 10.04 上运行 python 3.1.2

我需要安装哪个版本的 BeautifulSoup 以及如何安装?

我已经下载了 3.2 版本并运行 sudo python3 setup.py install但不起作用

谢谢

我得到的错误是:

<预><代码>>>>进口美汤回溯(最近一次调用最后一次):文件<stdin>",第 1 行,在 <module> 中文件BeautifulSoup.py",第 448 行引发 AttributeError, "'%s' 对象没有属性 '%s'" % (self.__class__.__name__, attr)^语法错误:无效语法>>>

解决方案

唯一适用于 Python 3 的 BeautifulSoup 系列是 3.1 不过作者已经放弃了,不会再发布更新了.您可以在此处阅读有关问题的更多信息.

更新:这不再是真的,BeautifulSoup 4 适用于 Python 3.您可以使用 pip install beautifulsoup4 安装它.

pip install BeautifulSoup 将安装第 3 版.

im running python 3.1.2 on my ubuntu 10.04

which version of BeautifulSoup i need to install and how?

i already download version 3.2 and run sudo python3 setup.py install but doesnt works

thnx

EDIT : The error i get is :

>>> import BeautifulSoup
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "BeautifulSoup.py", line 448
    raise AttributeError, "'%s' object has no attribute '%s'" % (self.__class__.__name__, attr)
                        ^
SyntaxError: invalid syntax
>>> 

解决方案

The only series of BeautifulSoup which works with Python 3 is 3.1 However the author has abandoned it and will not release updates. You can read more about the problems here.

UPDATE: This is no longer true, BeautifulSoup 4 works on Python 3. You can install it with pip install beautifulsoup4.

pip install BeautifulSoup will install version 3.

这篇关于安装 BeautifulSoup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆