请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

报错了,求解答

import requests

from xml import etree

headers = {
‘Referer’:‘http://angelimg.spbeen.com
}

response = requests.get(url)

html = etree.HTML(response.text)

images_links = html.xpath(’.//img/@src’)

for link in images_links:
print(link)


报错内容
E:\pyfime\code\venv\Scripts\python.exe E:\pyfime\code\main.py
Traceback (most recent call last):
File “E:\pyfime\code\main.py”, line 2, in
import requests
ModuleNotFoundError: No module named ‘requests’

Process finished with exit code 1

正在回答 回答被采纳积分+3

1回答

小布_老师 2024-06-06 16:08:17

ModuleNotFoundError: No module named ‘requests’。没有名称为requests的库。环境中缺失了requests,用pip安装一下。命令行:

pip install requests


0 回复 有任何疑惑可以回复我~
  • 提问者 Bin_key #1
    C:\Users\Max.liang>pip install requests
    Collecting requests
     中间忽略了一大堆
    Installing collected packages: charset-normalizer, idna, urllib3, certifi, requests
    Successfully installed certifi-2024.6.2 charset-normalizer-3.3.2 idna-3.7 requests-2.32.3 urllib3-2.2.1
    WARNING: You are using pip version 19.2.3, however version 24.0 is available.
    You should consider upgrading via the 'python -m pip install --upgrade pip' command.
    
    
    好像还有问题了~
    回复 有任何疑惑可以回复我~ 2024-06-06 16:20:42
  • 小布_老师 回复 提问者 Bin_key #2
    提示更新,这个不是错误,没事的
    回复 有任何疑惑可以回复我~ 2024-06-07 11:59:20
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信