当前位置:网站首页>怎么自动安装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) - 等待自动跑脚本安装即可
好久没更新,哎,自创更新也烦呀
边栏推荐
- [paddlepaddle] paddedetection face recognition custom data set
- 开户注册挖财安全吗?有没有风险的?靠谱吗?
- 使用Jmeter虚拟化table失败
- 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
- Whether to take a duplicate subset with duplicate elements [how to take a subset? How to remove duplicates?]
- Privacy computing helps secure data circulation and sharing
- 让更多港澳青年了解南沙特色文创产品!“南沙麒麟”正式亮相
- LeetCode 6111. 螺旋矩阵 IV
- Memory management chapter of Kobayashi coding
- 华夏基金:基金行业数字化转型实践成果分享
猜你喜欢

Simulate the hundred prisoner problem

彻底理解为什么网络 I/O 会被阻塞?
![含重复元素取不重复子集[如何取子集?如何去重?]](/img/b2/d019c3f0b85a6c0d334a092fa6c23c.png)
含重复元素取不重复子集[如何取子集?如何去重?]

Isprs2022 / Cloud Detection: Cloud Detection with Boundary nets Boundary Networks Based Cloud Detection

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

The 11th China cloud computing standards and Applications Conference | cloud computing national standards and white paper series release, and Huayun data fully participated in the preparation

LeetCode 6109. 知道秘密的人数

Let more young people from Hong Kong and Macao know about Nansha's characteristic cultural and creative products! "Nansha kylin" officially appeared

nano的CAN通信

Sophon kg upgrade 3.1: break down barriers between data and liberate enterprise productivity
随机推荐
pytorch yolov5 训练自定义数据
About statistical power
[use electron to develop desktop on youqilin]
Maximum artificial island [how to make all nodes of a connected component record the total number of nodes? + number the connected component]
LeetCode笔记:Weekly Contest 300
Is it safe for Apple mobile phone to speculate in stocks? Is it a fraud to get new debts?
English sentence pattern reference
Sophon kg upgrade 3.1: break down barriers between data and liberate enterprise productivity
分享:中兴 远航 30 pro root 解锁BL magisk ZTE 7532N 8040N 9041N 刷机 刷面具原厂刷机包 root方法下载
Electron installation problems
Thoroughly understand why network i/o is blocked?
rust统计文件中单词出现的次数
U-Net: Convolutional Networks for Biomedical Images Segmentation
Writing writing writing
Image classification, just look at me!
使用Jmeter虚拟化table失败
含重复元素取不重复子集[如何取子集?如何去重?]
JDBC reads a large amount of data, resulting in memory overflow
彻底理解为什么网络 I/O 会被阻塞?
写作写作写作写作