报错信息
F:\HuaDaBoSi\scratch\venv\Scripts\python.exe F:/HuaDaBoSi/scratch/weather_hengyang/weather.py
ImportError: lxml not found, please install it
解决办法
切换到终端
输入
F:\HuaDaBoSi\scratch>F:\HuaDaBoSi\scratch\venv\Scripts\python.exe -m pip install lxml
结果出现了这个错误
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. WARNING: You are using pip version 20.1.1; however, version 23.1 is available. You should consider upgrading via the 'F:\HuaDaBoSi\scratch\venv\Scripts\python.exe -m pip install --upgrade pip' command.
根据提示更新pip版本
F:\HuaDaBoSi\scratch>F:\HuaDaBoSi\scratch\venv\Scripts\python.exe -m pip install --upgrade pip
更新成功
再次下载lxml
F:\HuaDaBoSi\scratch\venv\Scripts\python.exe -m pip install lxml
image.png
成功安装,此时在运行就不会报错啦~~~
完结撒花
python爬虫还是挺好玩的
之前一直觉得很难了
just so so
明天在写几个案例就差不多了