当前位置:网站首页>怎么自动安装pythn三方库
怎么自动安装pythn三方库
2022-07-05 18:19:00 【终端小蛙】
最近由于经常要换电脑,而换电脑之后同步自己之前的python环境,那么就搞了一个简单的解决方案
- 在原电脑上使用 pip list打印出安装的三方库
pip list
结果如下
- 在新电脑上安装完python环境后,跑下述脚本
import os import re def auto_install(fn:str): # 输入的fn为pip list中输出的格式 libPatten = re.compile("\s*(\w+)\s*([\d\.]+)") with open(fn,"r") as f: lines = f.readlines() for line in lines: libRe = libPatten.match(line) if libRe: libname = libRe.group(1) version = libRe.group(2) os.system("pip install "+libname +"=="+version) if __name__ == "__main__": fn = r"xxx.txt" auto_install(fn) - 等待自动跑脚本安装即可
好久没更新,哎,自创更新也烦呀
边栏推荐
- VC编程入门浅谈「建议收藏」
- Memory leak of viewpager + recyclerview
- MATLAB中print函数使用
- 让更多港澳青年了解南沙特色文创产品!“南沙麒麟”正式亮相
- Sophon AutoCV:助力AI工业化生产,实现视觉智能感知
- 图扑软件数字孪生 | 基于 BIM 技术的可视化管理系统
- 开户注册挖财安全吗?有没有风险的?靠谱吗?
- How to solve the error "press any to exit" when deploying multiple easycvr on one server?
- rust统计文件中单词出现的次数
- [paddlepaddle] paddedetection face recognition custom data set
猜你喜欢

The 10th global Cloud Computing Conference | Huayun data won the "special contribution award for the 10th anniversary of 2013-2022"

The 11th China cloud computing standards and Applications Conference | China cloud data has become the deputy leader unit of the cloud migration special group of the cloud computing standards working

寻找第k小元素 前k小元素 select_k

Sophon base 3.1 launched mlops function to provide wings for the operation of enterprise AI capabilities

U-Net: Convolutional Networks for Biomedical Images Segmentation

彻底理解为什么网络 I/O 会被阻塞?

【HCIA-cloud】【1】云计算的定义、什么是云计算、云计算的架构与技术说明、华为云计算产品、华为内存DDR配置工具说明
![最大人工岛[如何让一个连通分量的所有节点都记录总节点数?+给连通分量编号]](/img/8b/a60fc36115580f018445e4c2a28a9d.png)
最大人工岛[如何让一个连通分量的所有节点都记录总节点数?+给连通分量编号]

星环科技重磅推出数据要素流通平台Transwarp Navier,助力企业实现隐私保护下的数据安全流通与协作

FCN: Fully Convolutional Networks for Semantic Segmentation
随机推荐
How can cluster deployment solve the needs of massive video access and large concurrency?
隐私计算助力数据的安全流通与共享
检查命名空间和类
Numerical calculation method chapter8 Numerical solutions of ordinary differential equations
Star Ring Technology launched transwarp Navier, a data element circulation platform, to help enterprises achieve secure data circulation and collaboration under privacy protection
[paddlepaddle] paddedetection face recognition custom data set
开户注册挖财安全吗?有没有风险的?靠谱吗?
English sentence pattern reference
Memory management chapter of Kobayashi coding
第十一届中国云计算标准和应用大会 | 云计算国家标准及白皮书系列发布 华云数据全面参与编制
Gimp 2.10 tutorial "suggestions collection"
Problems encountered in the project u-parse component rendering problems
Is it safe to open an account, register and dig money? Is there any risk? Is it reliable?
彻底理解为什么网络 I/O 会被阻塞?
[utiliser Electron pour développer le Bureau sur youkirin devrait]
node_ Exporter memory usage is not displayed
Is it safe to open an account and register stocks for stock speculation? Is there any risk? Is it reliable?
Copy the linked list with random pointer in the "Li Kou brush question plan"
pytorch yolov5 训练自定义数据
【PaddleClas】常用命令