当前位置:网站首页>怎么自动安装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) - 等待自动跑脚本安装即可
好久没更新,哎,自创更新也烦呀
边栏推荐
- 南京大学:新时代数字化人才培养方案探讨
- Sophon KG升级3.1:打破数据间壁垒,解放企业生产力
- LeetCode 6109. 知道秘密的人数
- 热通孔的有效放置如何改善PCB设计中的热管理?
- Record a case of using WinDbg to analyze memory "leakage"
- 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
- 从XML架构生成类
- 彻底理解为什么网络 I/O 会被阻塞?
- 【PaddleClas】常用命令
- 让更多港澳青年了解南沙特色文创产品!“南沙麒麟”正式亮相
猜你喜欢

About Statistical Power(统计功效)

模拟百囚徒问题

第十届全球云计算大会 | 华云数据荣获“2013-2022十周年特别贡献奖”

吴恩达团队2022机器学习课程,来啦

Star ring technology data security management platform defender heavy release

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

Use JMeter to record scripts and debug

How to obtain the coordinates of the aircraft passing through both ends of the radar

U-Net: Convolutional Networks for Biomedical Images Segmentation

LeetCode 6109. Number of people who know the secret
随机推荐
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
About Estimation with Cross-Validation
记一次使用Windbg分析内存“泄漏”的案例
GIMP 2.10教程「建议收藏」
快速生成ipa包
Numerical calculation method chapter8 Numerical solutions of ordinary differential equations
写作写作写作写作
sample_rate(采樣率),sample(采樣),duration(時長)是什麼關系
JDBC reads a large amount of data, resulting in memory overflow
从类生成XML架构
使用Jmeter虚拟化table失败
The 2022 China Xinchuang Ecological Market Research and model selection evaluation report released that Huayun data was selected as the mainstream manufacturer of Xinchuang IT infrastructure!
[PM2 details]
让更多港澳青年了解南沙特色文创产品!“南沙麒麟”正式亮相
Sophon base 3.1 launched mlops function to provide wings for the operation of enterprise AI capabilities
Electron installation problems
[QNX hypervisor 2.2 user manual]6.3.2 configuring VM
Le cours d'apprentissage de la machine 2022 de l'équipe Wunda arrive.
U-Net: Convolutional Networks for Biomedical Images Segmentation
Simulate the hundred prisoner problem