错误求解决

来源:3-4 BeautifulSoup使用

k2nn3

2016-10-09 13:48

#!/usr/bin/env python
# -*- coding:utf-8 -*-
from urllib import request
from bs4 import BeautifulSoup as bs
req=request.Request("http://www.baidu.com")
req.add_header("User-Agent","Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36")
resp=request.urlopen(req)
soup=bs(resp,"html_parser")
print(soup.img)


Traceback (most recent call last):
  File "C:/Users/Administrator.WIN7-20160710FD/PycharmProjects/untitled1/pc1.py", line 4, in <module>
    from bs4 import BeautifulSoup as bs
ImportError: No module named 'bs4'

Process finished with exit code 1



写回答 关注

1回答

  • 秋名山车神
    2016-10-09 14:34:03

    这应该是你没有安装 BeautifulSoup4的缘故

    慕婉清622...

    安装成功了,还是这样报错 ModuleNotFoundError: No module named 'bs4

    2017-12-14 21:00:59

    共 1 条回复 >

python遇见数据采集

本教程让你初步掌握Python进行数据采集,创造属于你的价值

59669 学习 · 200 问题

查看课程

相似问题