python——从文件中批量导入和导出安装包,安装包时遇到速度慢-加国内代理。

一、python 安装包时遇到速度慢-加国内代理。

 pip install PyQt5

在这里插入图片描述

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

在这里插入图片描述

常用国内镜像地址:
清华大学: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/

二、批量导入和导出文件中的包

1、批量导出安装包

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

在这里插入图片描述
在这里插入图片描述

2、批量导入安装包

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

在这里插入图片描述

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

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_45195493/article/details/128185500