Python requests包安装教程

刚开始学习python,使用中发现导的requests包不可用,原因是本地并没有安装requests包。报错如下:
python报错图片
既然本地没有requests包,那就去官网下载安装。requests包下载地址https://pypi.org/project/requests/#files
下载图片
下载tar包,然后把压缩包解压到本地,解压后的文件夹放在python安装路径中的Lib包下
这里写图片描述

记住路径,然后打开Windows终端,windows+R键,输入cmd进入终端,然后切换盘符,进入requests文件所在的路径。进入之后输入命令:python setup.py install
这里写图片描述

等待安装即可。贴部分安装代码

running install
running bdist_egg
running egg_info
writing requests.egg-info\PKG-INFO
writing dependency_links to requests.egg-info\dependency_links.txt
writing requirements to requests.egg-info\requires.txt
writing top-level names to requests.egg-info\top_level.txt
reading manifest file 'requests.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'NOTICE'
writing manifest file 'requests.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build
creating build\lib
creating build\lib\requests
copying requests\adapters.py -> build\lib\requests
copying requests\api.py -> build\lib\requests
copying requests\auth.py -> build\lib\requests
copying requests\certs.py -> build\lib\requests
copying requests\compat.py -> build\lib\requests
copying requests\cookies.py -> build\lib\requests
copying requests\exceptions.py -> build\lib\requests
copying requests\help.py -> build\lib\requests
copying requests\hooks.py -> build\lib\requests
copying requests\models.py -> build\lib\requests
copying requests\packages.py -> build\lib\requests
copying requests\sessions.py -> build\lib\requests
copying requests\status_codes.py -> build\lib\requests
copying requests\structures.py -> build\lib\requests
copying requests\utils.py -> build\lib\requests
copying requests\_internal_utils.py -> build\lib\requests
copying requests\__init__.py -> build\lib\requests
copying requests\__version__.py -> build\lib\requests
creating build\bdist.win32
creating build\bdist.win32\egg
creating build\bdist.win32\egg\requests
copying build\lib\requests\adapters.py -> build\bdist.win32\egg\requests
copying build\lib\requests\api.py -> build\bdist.win32\egg\requests
copying build\lib\requests\auth.py -> build\bdist.win32\egg\requests
copying build\lib\requests\certs.py -> build\bdist.win32\egg\requests
copying build\lib\requests\compat.py -> build\bdist.win32\egg\requests
copying build\lib\requests\cookies.py -> build\bdist.win32\egg\requests
copying build\lib\requests\exceptions.py -> build\bdist.win32\egg\requests
copying build\lib\requests\help.py -> build\bdist.win32\egg\requests

安装成功提示:

Installed d:\develop\software\python\lib\site-packages\certifi-2018.4.16-py3.6.egg
Searching for urllib3<1.23,>=1.21.1
Reading https://pypi.python.org/simple/urllib3/
Downloading https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl#sha256=06330f386d6e4b195fbfc736b297f58c5
ea1b
Best match: urllib3 1.22
Processing urllib3-1.22-py2.py3-none-any.whl
Installing urllib3-1.22-py2.py3-none-any.whl to d:\develop\software\python\lib\site-packages
writing requirements to d:\develop\software\python\lib\site-packages\urllib3-1.22-py3.6.egg\EGG-INFO\requires.txt
Adding urllib3 1.22 to easy-install.pth file

Installed d:\develop\software\python\lib\site-packages\urllib3-1.22-py3.6.egg
Searching for idna<2.7,>=2.5
Reading https://pypi.python.org/simple/idna/
Downloading https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl#sha256=8c7309c718f94b3a625cb648ace320157ad16

Best match: idna 2.6
Processing idna-2.6-py2.py3-none-any.whl
Installing idna-2.6-py2.py3-none-any.whl to d:\develop\software\python\lib\site-packages
Adding idna 2.6 to easy-install.pth file

Installed d:\develop\software\python\lib\site-packages\idna-2.6-py3.6.egg
Searching for chardet<3.1.0,>=3.0.2
Reading https://pypi.python.org/simple/chardet/
Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl#sha256=fc323ffcaeaed0e0a02bf4d117757b98
06691
Best match: chardet 3.0.4
Processing chardet-3.0.4-py2.py3-none-any.whl
Installing chardet-3.0.4-py2.py3-none-any.whl to d:\develop\software\python\lib\site-packages
Adding chardet 3.0.4 to easy-install.pth file
Installing chardetect-script.py script to D:\develop\software\python\Scripts
Installing chardetect.exe script to D:\develop\software\python\Scripts
Installing chardetect.exe.manifest script to D:\develop\software\python\Scripts

Installed d:\develop\software\python\lib\site-packages\chardet-3.0.4-py3.6.egg
Finished processing dependencies for requests==2.18.4

D:\develop\software\python\Lib\requests-2.18.4>

安装成功之后,再去运行python就可以了。其他导包问题同样解决。希望可以帮助到刚开始学习python的小伙伴。

  • 36
    点赞
  • 95
    收藏
    觉得还不错? 一键收藏
  • 27
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 27
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值