安装request库

python里的request库经常被用于进行网络爬虫,想要学习网络爬虫的同学必须得安装request这个第三方库,接下来就是安装这个库的步骤

刚开始时,你是没有这个模块的在这里插入图片描述

那么就得安装导入了

方法一:

1.确定自己以前没有安装过,那么就打开这个网址,进去下载(gz)https://pypi.org/project/pip/#files

在这里插入图片描述
等待下载好后,解压再放到你的python文件夹里的Lib里面在这里插入图片描述

方法二:

利用pip安装,这种方法很简单,但是我这边莫名的会出错

WARNING: You are using pip version 20.3; however, version 21.2.4 is available.
You should consider upgrading via the ‘c:\program files\python38\python.exe -m pip install --upgrade pip’ command.

WARNING: The script tqdm.exe is installed in ‘C:\Users\wj\AppData\Roaming\Python\Python38\Scripts’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The scripts convert-caffe2-to-onnx.exe and convert-onnx-to-caffe2.exe are installed in ‘C:\Users\wj\AppData\Roaming\Python\Python38\Scripts’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script f2py.exe is installed in ‘C:\Users\wj\AppData\Roaming\Python\Python38\Scripts’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

打开命令提示框
然后输入: pip install requests

有的人这样输入之后就好了,但我这边出了点差错在这里插入图片描述
WARNING: You are using pip version 20.3; however, version 21.2.4 is available.
You should consider upgrading via the ‘c:\program files\python38\python.exe -m pip install --upgrade pip’ command.

实际上就是说明你的pip版本需要更新
更新一下
输入:pip install --upgrade pip
或者: python.exe -m pip install --upgrade pip

就好了在这里插入图片描述

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐