python——Import and export installation packages in batches from files, and encounter slow speed when installing packages-plus domestic agents.

1. Slow speed when installing python package - add domestic agent.

 pip install PyQt5

insert image description here

命令格式:
pip install -i 镜像地址 包名
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ PyQt5

insert image description here

常用国内镜像地址:
清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云:https://mirrors.aliyun.com/pypi/simple/
豆瓣网:https://pypi.douban.com/simple/
中国科技大学:https://pypi.mirrors.ustc.edu.cn/simple/

2. Batch import and export of packages in files

1. Export installation packages in batches

终端-路径- pip freeze > requirements.txt(导出包)

insert image description here
insert image description here

2. Import installation packages in batches

终端 - 路径 -  pip install -r requirements.txt (安装文件中包)

insert image description here

终端-路径-   pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ -r requirements.txt

insert image description here

Supongo que te gusta

Origin blog.csdn.net/weixin_45195493/article/details/128185500
Recomendado
Clasificación