赞
踩
目的:导入模块 requests
import requests #导入requests 模块
问题:Module Not Found Error: No module named ‘requests’
Win + R 输入cmd 后回车,再输入pip install requests 回车,即可安装 requests 模块
Win + R 输入cmd 后回车,再输入pip install requests 回车,发现已安装 requests 模块
找到 requests 所在安装目录,手动配置解释器 Interpreter,设置为 requests 所在的 python.exe
response = requests.get("http://www.example.com") #抓取网页上的内容
print(response.content)
pip 工具是从 python 官方的镜像网站下载模块,pip 允许设置特定的镜像网站,如
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests
更新 pip 工具
python -m pip install --upgrade pip
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。