1.ImportError: No module named BeautifulSoup       

当你成功安装BeautifulSoup 4库后,“from BeautifulSoup import BeautifulSoup”可能会遇到该错误。

安装beautifulsoup库时遇到麻烦
安装beautifulsoup库时遇到麻烦
        其中的原因是BeautifulSoup 4库改名为bs4,需要使用“from bs4 import BeautifulSoup”导入。

        2.TypeError: an integer is required

        当你使用“print soup.title.string”获取title的值时,可能会遇到该错误。如下:
安装beautifulsoup库时遇到麻烦
        它应该是IDLE的BUG,当使用命令行Command没有任何错误。参考:stackoverflow。同时可以通过下面的代码解决该问题:
        print unicode(soup.title.string)
        print str(soup.title.string)

下载地址:https://www.crummy.com/software/BeautifulSoup/bs4/download/

下载完成后解压到python安装包的地方,存放在Beautifulsoup.**文件下安装beautifulsoup库时遇到麻烦

安装beautifulsoup库时遇到麻烦

 

win+R  ————cmd  cd (第 2 步放置安装包的位置)C:\Python36\beautifulsoup4-4.6.0

安装:python steup.py install

二. 安装及介绍Beautiful Soup库

安装beautiful soup库

#安装
pip install beautifulsoup4
#检查
from bs4 import Beautiful Soup
#安装 lxml
pip install lxml
捷径

相关文章:

  • 2021-10-20
  • 2022-12-23
  • 2021-10-26
  • 2021-06-19
  • 2021-06-08
  • 2021-11-20
  • 2022-12-23
  • 2021-12-12
猜你喜欢
  • 2021-09-26
  • 2021-08-28
  • 2021-10-22
  • 2022-12-23
  • 2021-04-10
  • 2021-06-20
  • 2022-02-09
相关资源
相似解决方案