(v365env) ➜ music163-spiders git:(master) ✗ python get_artists.py
Traceback (most recent call last):
File "get_artists.py", line 44, in <module>
get_artists(url)
File "get_artists.py", line 26, in get_artists
soup = BeautifulSoup(r.text, 'html5lib')
File "/Users/qk/.pyenv/versions/v365env/lib/python3.6/site-packages/bs4/__init__.py", line 198, in __init__
% ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib. Do you need to install a parser library?
(v365env) ➜ music163-spiders git:(master) ✗ python --version
Python 3.6.5
(v365env) ➜ music163-spiders git:(master) ✗ pip install requests BeautifulSoup4
Requirement already satisfied: requests in /Users/qk/.pyenv/versions/3.6.5/envs/v365env/lib/python3.6/site-packages (2.20.1)
Requirement already satisfied: BeautifulSoup4 in /Users/qk/.pyenv/versions/3.6.5/envs/v365env/lib/python3.6/site-packages (4.6.3)
Requirement already satisfied: idna<2.8,>=2.5 in /Users/qk/.pyenv/versions/3.6.5/envs/v365env/lib/python3.6/site-packages (from requests) (2.7)
Requirement already satisfied: certifi>=2017.4.17 in /Users/qk/.pyenv/versions/3.6.5/envs/v365env/lib/python3.6/site-packages (from requests) (2018.10.15)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /Users/qk/.pyenv/versions/3.6.5/envs/v365env/lib/python3.6/site-packages (from requests) (1.24.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /Users/qk/.pyenv/versions/3.6.5/envs/v365env/lib/python3.6/site-packages (from requests) (3.0.4)
(v365env) ➜ music163-spiders git:(master) ✗ python get_artists.py
Traceback (most recent call last):
File "get_artists.py", line 44, in <module>
get_artists(url)
File "get_artists.py", line 26, in get_artists
soup = BeautifulSoup(r.text, 'html5lib')
File "/Users/qk/.pyenv/versions/v365env/lib/python3.6/site-packages/bs4/__init__.py", line 198, in __init__
% ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib. Do you need to install a parser library?
参考例子:
1
dibis OP '''
➜ ~ pyenv versions * system (set by /Users/qk/.pyenv/version) 3.6.5 3.6.5/envs/v365env v365env ''' |
2
likuku 2018-11-25 00:52:39 +08:00
@jnuc093
➜ ~ pyenv versions * system (set by /Users/qk/.pyenv/version) # 你这显示的表示你当前所在位置用的还是系统自带的 python 啊,并没有用到你 pyenv 安装的版本。 |
3
likuku 2018-11-25 00:56:11 +08:00
" Couldn't find a tree builder with the features you requested: html5lib"
这么明确的提示了吗... 缺啥就装啥啊。 确认你在你项目的目录下,确认使用你正确的 pyenv 或者 virtualenv 环境, pip search html5lib # 先确认 pip 库里有没有,我确认过了,有的。 pip install html5lib # 装完它之后,再试吧 |
4
quinoa42 2018-11-25 07:08:03 +08:00
html5lib 并不是 beautifulsoap 的硬性依赖,要用的话得 pip install html5lib
|
5
dibis OP (v365env) ➜ music163-spiders git:(master) ✗ pip install html5lib
Collecting html5lib Using cached https://files.pythonhosted.org/packages/a5/62/bbd2be0e7943ec8504b517e62bab011b4946e1258842bc159e5dfde15b96/html5lib-1.0.1-py2.py3-none-any.whl Collecting six>=1.9 (from html5lib) Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl Collecting webencodings (from html5lib) Using cached https://files.pythonhosted.org/packages/f4/24/2a3e3df732393fed8b3ebf2ec078f05546de641fe1b667ee316ec1dcf3b7/webencodings-0.5.1-py2.py3-none-any.whl Installing collected packages: six, webencodings, html5lib Successfully installed html5lib-1.0.1 six-1.11.0 webencodings-0.5.1 (v365env) ➜ music163-spiders git:(master) ✗ pyenv versions system 3.6.5 3.6.5/envs/v365env * v365env (set by PYENV_VERSION environment variable) |