Skip to content

wangy8961/python3-concurrency-pics-01

Repository files navigation

Python aiohttp BeautifulSoup4 requests pymongo progressbar2

1. 进度条

2. 截图

3. 使用方法

3.1 下载代码

[root@CentOS ~]# git clone https://github.com/wangy8961/python3-concurrency-pics-01.git
[root@CentOS ~]# cd python3-concurrency-pics-01/

3.2 准备虚拟环境

如果你的操作系统是Linux:

[root@CentOS python3-concurrency-pics-01]# python3 -m venv venv3
[root@CentOS python3-concurrency-pics-01]# source venv3/bin/activate

Windows激活虚拟环境的命令是: venv3\Scripts\activate

3.3 安装依赖包

如果你的操作系统是Linux:

(venv3) [root@CentOS python3-concurrency-pics-01]# pip install -r requirements-linux.txt

如果你的操作系统是Windows(不会使用uvloop):

(venv3) C:\Users\wangy> pip install -r requirements-win32.txt

3.4 测试

(1) 依序下载

(venv3) [root@CentOS python3-concurrency-pics-01]# python sequential.py

(2) 多线程下载

(venv3) [root@CentOS python3-concurrency-pics-01]# python threadpool.py

(3) 异步下载

(venv3) [root@CentOS python3-concurrency-pics-01]# python asynchronous.py

4. 爬虫系列

4.1 理论

4.2 实验

4.3 实战