笔记2-请求库安装

作者: 路由心定 | 来源:发表于2019-01-08 10:18 被阅读0次

1.Requests安装

1.pip3 install requests
2.验证安装

$python3
>>>import requests
图-1.png

3.安装过程中遇到的问题

#问题1
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting requests
  Could not fetch URL https://pypi.python.org/simple/requests/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
  Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
#问题1-解决方法:依次执行以下步骤
--1--:重新进入python3目录
--2--:./configure --with-ssl
--3--:make
--4--:sudo make install

2.wheel安装

1.pip3 install wheel

3.Selenium安装

1.Selenium--自动化 测试工具--主要用作驱动浏览器
2.pip3 install selenium
3.验证安装

$python3
>>> import selenium
图-2.png

4.GeckoDriver安装

1.下载地址

https://github.com/mozilla/geckodriver/releases
图-3.png
2.环境变量配置
--方法1:
sudo mv geckodriver /usr/bin

3.验证

#调用火狐浏览器,会打开空白页面
from selenium import webdriver
driver=webdriver.Firefox()

5.PhantomJS安装

1.无界面、可脚本编程、WebKit浏览器引擎
2.安装步骤

--1--:wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
--如果下载提示找不到资源,登录官网下载http://phantomjs.org/download.html
--2--:tar -xjvf phantomjs-2.1.1-linux-x86_64.tar.bz2
--3--:sudo ln -s 下载目录/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs

3.验证安装

$phantomjs -v
图-4.png

6.aiohttp安装

1.requests库是一个阻塞式HTTP请求库,当发出请求时程序会一直等待响应直到得到响应,比较耗时所以需要一个异步Web服务库-aiohttp
2.pip安装

1.安装aiohttp
pip3 install  aiohttp
2.官方推荐安装字符编码检测库、加速DNS解析库aiodns
pip3 install cchardet aiodns

3.验证安装

$python3
>>> import aiohttp
图-5.png

7.讨论交流

q:725054061

相关文章

  • 笔记2-请求库安装

    1.Requests安装 1.pip3 install requests2.验证安装 3.安装过程中遇到的问题 2...

  • 01_依赖库的安装

    请求库的安装 requests:阻塞式http请求库$ pip install requests selenium...

  • swift 网络请求框架 Alamofire

    使用cocoapods安装网络请求库 Alamofire 默认是get请求 get 请求 post 请求

  • 爬取网红小姐姐图片(简单入门)

    简单爬虫 安装第三方库请求页面解析网页保存图片 安装第三方库 安装第三方请求库(requests)pip inst...

  • 请求库安装

    爬虫程序分为三步:1.抓取页面2.分析页面3.存储数据在抓取页面时需要模拟浏览器向服务器发送请求,所以需要一些Py...

  • 请求库安装

    爬虫需要安装第三方库,requests、Selenium (以下均只展示Windows系统下的操作) 1. 安装r...

  • Python请求库安装

    请求库安装 爬虫可以简单分为几步:抓取页面、分析页面和存储数据 requests 安装 pip3 install ...

  • manim学习

    动画库Manim学习笔记——安装与环境配置(一)动画库Manim学习笔记——Manim库的基本结构(二)动画库Ma...

  • 【为了尊严】爬虫(二)

    一、urllib ** urllib是python内置的请求库,不需要额外安装** request:模拟发送请求,...

  • 爬虫技术(1) 前置知识与架构

    1. requests 库的使用 安装 发送请求 (1)请求方式 Get 查看资源 POST 增加资源 PUT 修...

网友评论

    本文标题:笔记2-请求库安装

    本文链接:https://www.haomeiwen.com/subject/cphhrqtx.html