在使用pip install "第三方库名"下载第三方库时,速度相当感人。
是因为pip源默认是国外的,为了使下载速度可以更快,我们可以更改为国内的源
win +R 输入 cmd 打开命令窗口
输入
pip config set global.index-url + 国内源地址
即可更改为国内的原
例如:pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
国内源:
阿里云 https://mirrors.aliyun.com/pypi/simple/
清华 https://pypi.tuna.tsinghua.edu.cn/simple/
中科大 https://pypi.mirrors.ustc.edu.cn/simple/
清华:https://pypi.tuna.tsinghua.edu.cn/simple
山东理工大学:http://pypi.sdutlinux.org
豆瓣:http://pypi.douban.com/simple
python批量自动安装常用第三方库脚本:
import os
libs = {"numpy", "matplotlib", "pillow", "gooey","sklearn",
"requests", "pyinstaller","django", "jieba",
"beautifulsoup4", "wheel", "networkx", "sympy",
"flask", "werobot", "pyqt5", "pandas", "pyopengl",
"pypdf2", "docopt", "pygame","peewee","scrapy",
"behold","cython"} # 可以自行添加第三方库名称
try:
for lib in libs:
os.system("pip install " + lib)
print("成功安装")
except:
print("安装失败")