问题解决:UserWarning: No parser was explicitly specified

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/NaomiEdna/article/details/51694620

我用的是Python3.6.0, IDE 用的是PyCharm,操作系统是windows 10
今天写代码的时候遇到如下两个问题

  1. No module named requests
    requests module没法import,可以通过install Setup.py来解决
    (通过File-Settings-Project: Untitled - Project Interpreter,添加Setup来安装),我在添加setup的时候提示要安装pip,于是就按照下图先装好了pip,安装好后提示pip版本不对,需要安装新的,卸载旧版本,这时候根据系统提示,通过cmd进行操作
    这里写图片描述
    更新好了pip之后去添加setup
    如果添加setup不成功,还有另一个方法,即通过命令行手动下载requests。在cmd输入pip install requests, 即可自动下载
    这里写图片描述
    安装OK后就可以import requests了

  2. init.py:166: UserWarning: No parser was explicitly specified

错误提示:To get rid of this warning, change this: BeautifulSoup([your markup])
to this:
BeautifulSoup([your markup], “html.parsar”)
markup_type=markup_type))

这里写图片描述
按照错误提示,将代码里的 BeautifulSoup([your_markup]) 在[your_markup]后面加上”html.parsar”即可
这里写图片描述

修改好以上后,成功爬到了Goodreads里Stephen King的quotes
Voila~
这里写图片描述

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/NaomiEdna/article/details/51694620

我用的是Python3.6.0, IDE 用的是PyCharm,操作系统是windows 10
今天写代码的时候遇到如下两个问题

猜你喜欢

转载自blog.csdn.net/xuejiaguniang/article/details/83547695