当前位置:网站首页>怎么自动安装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) - 等待自动跑脚本安装即可
好久没更新,哎,自创更新也烦呀
边栏推荐
- Use JMeter to record scripts and debug
- 使用JMeter录制脚本并调试
- Let more young people from Hong Kong and Macao know about Nansha's characteristic cultural and creative products! "Nansha kylin" officially appeared
- What is the reason why the video cannot be played normally after the easycvr access device turns on the audio?
- JVM third talk -- JVM performance tuning practice and high-frequency interview question record
- About statistical power
- buuctf-pwn write-ups (9)
- 图扑软件数字孪生 | 基于 BIM 技术的可视化管理系统
- jdbc读大量数据导致内存溢出
- Is it safe for Apple mobile phone to speculate in stocks? Is it a fraud to get new debts?
猜你喜欢
![Maximum artificial island [how to make all nodes of a connected component record the total number of nodes? + number the connected component]](/img/8b/a60fc36115580f018445e4c2a28a9d.png)
Maximum artificial island [how to make all nodes of a connected component record the total number of nodes? + number the connected component]

U-Net: Convolutional Networks for Biomedical Images Segmentation

模拟百囚徒问题

Le cours d'apprentissage de la machine 2022 de l'équipe Wunda arrive.

LeetCode 6111. 螺旋矩阵 IV

Nacos distributed transactions Seata * * install JDK on Linux, mysql5.7 start Nacos configure ideal call interface coordination (nanny level detail tutorial)

第十一届中国云计算标准和应用大会 | 华云数据成为全国信标委云计算标准工作组云迁移专题组副组长单位副组长单位
![含重复元素取不重复子集[如何取子集?如何去重?]](/img/b2/d019c3f0b85a6c0d334a092fa6c23c.png)
含重复元素取不重复子集[如何取子集?如何去重?]

使用JMeter录制脚本并调试

The 10th global Cloud Computing Conference | Huayun data won the "special contribution award for the 10th anniversary of 2013-2022"
随机推荐
Sophon AutoCV:助力AI工业化生产,实现视觉智能感知
The 10th global Cloud Computing Conference | Huayun data won the "special contribution award for the 10th anniversary of 2013-2022"
Introduction to VC programming on "suggestions collection"
从XML架构生成类
生词生词生词生词[2]
小白入门NAS—快速搭建私有云教程系列(一)[通俗易懂]
消除`if()else{ }`写法
Le cours d'apprentissage de la machine 2022 de l'équipe Wunda arrive.
Gimp 2.10 tutorial "suggestions collection"
Privacy computing helps secure data circulation and sharing
星环科技重磅推出数据要素流通平台Transwarp Navier,助力企业实现隐私保护下的数据安全流通与协作
【pm2详解】
【PaddleClas】常用命令
U-Net: Convolutional Networks for Biomedical Images Segmentation
Penetrate the whole intranet through socks agent
ConvMAE(2022-05)
sample_rate(采样率),sample(采样),duration(时长)是什么关系
Sophon KG升级3.1:打破数据间壁垒,解放企业生产力
音视频包的pts,dts,duration的由来.
Is it safe to open an account and register stocks for stock speculation? Is there any risk? Is it reliable?