如何检查我的 BeautifulSoup 版本并将其恢复为旧版本?

发布于 2024-09-13 19:21:05 字数 331 浏览 2 评论 0原文

我正在使用 beautifulsoup,并且我收到一些带有开始标记等的 htmlparser 错误。

我在 crummy 的网站上读到,一个建议是返回到旧版本(3.08)。

我正在使用 Ubuntu,我是这样做的:

sudo apt-get install python-beautifulsoup

来安装它。

  1. 我如何查看我现在拥有的版本?
  2. 如何使用 apt-get 强制使用特定版本? (以及如何卸载我现在拥有的)

谢谢(我是 ubuntu 的新手)

最新版本的 ubuntu 10.04

I am using beautifulsoup, and I am getting some htmlparser errors with start tags etc.

I read on crummy's site that one suggestion is to go back to an older version (3.08).

I am using Ubuntu, where I did:

sudo apt-get install python-beautifulsoup

to install it.

  1. how can I check what version I have now?
  2. how can I force a specific version using apt-get? (and how to uninstall what I have now)

thanks (i'm newish to ubuntu)

latest version of ubuntu 10.04

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

浅唱ヾ落雨殇 2024-09-20 19:21:05

《美丽汤4》里是这样的:

>>> import bs4
>>> bs4.__version__
'4.4.1'

In Beautiful Soup 4 its like this:

>>> import bs4
>>> bs4.__version__
'4.4.1'
做个少女永远怀春 2024-09-20 19:21:05

我在 mac osx 10.5 上遇到同样的问题
我删除了当前版本的 beautiful soup,

sudo apt-get remove python-beautifulsoup

然后从 this 安装了 3.0.7 地址,现在一切正常。

要了解模块的当前版本:

import BeautifulSoup
print(BeautifulSoup.__version__)

i run in the same problem on mac osx 10.5
and i removed the current version of beautiful soup with

sudo apt-get remove python-beautifulsoup

then i installed 3.0.7 from this address and all is now working fine.

To know the current version of you module:

import BeautifulSoup
print(BeautifulSoup.__version__)
皇甫轩 2024-09-20 19:21:05

回答你的第一个问题:在 shell 提示符下,输入

python -c "import BeautifulSoup as bs; print(bs.__version__)"

Answer to your first question: at your shell prompt, type

python -c "import BeautifulSoup as bs; print(bs.__version__)"
甜味超标? 2024-09-20 19:21:05

对于你的第一个问题:

import BeautifulSoup
BeautifulSoup.__version__

对于第二个问题:

你不能。也许你应该使用 easy_install 或 pip 代替。

For your first question:

import BeautifulSoup
BeautifulSoup.__version__

And for the second:

You can't. Maybe you should use easy_install or pip instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文