问题解决:UserWarning: No parser was explicitly specified
我用的是Python3.6.0, IDE 用的是PyCharm,操作系统是windows 10
今天写代码的时候遇到如下两个问题
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了-
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~
我用的是Python3.6.0, IDE 用的是PyCharm,操作系统是windows 10
今天写代码的时候遇到如下两个问题