参考链接:https://www.cnblogs.com/jsben/p/5792952.html
tqdm模块
tqdm是一个快速、扩展性强的进度条工具库,
其githup地址:https:
/
/
github.com
/
tqdm
/
tqdm
1
)安装:
直接使用pip安装:
pip install tqdm
2
)使用:
from
time
import
sleep
from
tqdm
import
tqdm
for
i
in
tqdm(
range
(
1
,
500
)):
sleep(
0.01
)
自己实操:在ubuntu上默认安装到
2.7
环境变量里去了
root@ubuntu16:
/
alex
/
py
/
jingdutiao
# pip install tqdm
Collecting tqdm
Downloading tqdm
-
4.8
.
4
-
py2.py3
-
none
-
any
.whl
Installing collected packages: tqdm
Successfully installed tqdm
-
4.8
.
4
但是执行代码时,仍然出现No module of tqdm的错误。
接下来需要把tqdm安装到python3.5的环境中
pip install tqdm
cd
/
usr
/
local
/
lib
/
python2.
7
/
dist
-
packages
/
sudo cp
-
r tqdm tqdm
-
4.8
.
4.dist
-
info
/
/
usr
/
local
/
lib
/
python3.
5
/
dist
-
packages
cd /
usr
/
local
/
lib
/
python3.
5
/
dist
-
packages
ls 命令查看,
显示:tqdm-4.19.6.dist-info;
接下来可以执行代码了。
root@ubuntu16:
/
alex
/
py
/
jingdutiao
# cat test5.py
from
time
import
sleep
from
tqdm
import
tqdm
for
i
in
tqdm(
range
(
1
,
500
)):
sleep(
0.01
)
root@ubuntu16:
/
alex
/
py
/
jingdutiao
# python3 test5.py
100
%
|████████████████████████████████████████████████████████████████████████|
499
/
499
[
00
:
05
<
00
:
00
,
92.20it
/
s