在执行《空气质量指数》第6节课代码中出现的错误提示是什么意思?

C:\Users\user\PycharmProjects\lect09\venv\Scripts\python.exe C:/Users/user/PycharmProjects/lect09/aqi_v6.0.py
请输入城市拼音:shanghai
Traceback (most recent call last):
  File "C:/Users/user/PycharmProjects/lect09/aqi_v6.0.py", line 42, in <module>
    main()
  File "C:/Users/user/PycharmProjects/lect09/aqi_v6.0.py", line 38, in main
    city_aqi = get_city_aqi(city_pingyin)
  File "C:/Users/user/PycharmProjects/lect09/aqi_v6.0.py", line 21, in get_city_aqi
    soup = BeautifulSoup(r.text,"lxml")
  File "C:\Users\user\PycharmProjects\lect09\venv\lib\site-packages\bs4\__init__.py", line 165, in __init__
    % ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?

 

Robin_TY - PhD@CSU,研究方向:计算机视觉,模式识别

赞同来自:

没有找到beautiful的网页解析器lxml,有两种解决方式: 1. 安装lxml
pip install -U lxml
2. 使用另一种解析器,html.parser
soup = BeautifulSoup(r.text, 'html.parser')

Travelle3ih

赞同来自:

请问一下用pycharm的话,pip的命令是在哪里执行?在anaconda目录下还是在pycharm里执行呢?我的pycharm编译器里显示有lxml这个库,但是就是执行不了。

要回复问题请先登录注册