当前位置:网站首页>怎么自动安装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)
- 等待自动跑脚本安装即可
好久没更新,哎,自创更新也烦呀
边栏推荐
- U-Net: Convolutional Networks for Biomedical Images Segmentation
- 吴恩达团队2022机器学习课程,来啦
- buuctf-pwn write-ups (9)
- Vulnhub's darkhole_ two
- To solve the stubborn problem of Lake + warehouse hybrid architecture, xinghuan Technology launched an independent and controllable cloud native Lake warehouse integrated platform
- 爱因斯坦求和einsum
- Eliminate the writing of 'if () else{}'
- 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
- LeetCode笔记:Weekly Contest 300
- How to solve the error "press any to exit" when deploying multiple easycvr on one server?
猜你喜欢
Sophon base 3.1 launched mlops function to provide wings for the operation of enterprise AI capabilities
南京大学:新时代数字化人才培养方案探讨
LeetCode 6109. Number of people who know the secret
Record eval() and no in pytoch_ grad()
第十一届中国云计算标准和应用大会 | 华云数据成为全国信标委云计算标准工作组云迁移专题组副组长单位副组长单位
使用Jmeter虚拟化table失败
Let more young people from Hong Kong and Macao know about Nansha's characteristic cultural and creative products! "Nansha kylin" officially appeared
Nanjing University: Discussion on the training program of digital talents in the new era
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!
小林coding的内存管理章节
随机推荐
隐私计算助力数据的安全流通与共享
Access the database and use redis as the cache of MySQL (a combination of redis and MySQL)
VC编程入门浅谈「建议收藏」
金太阳开户安全吗?万一免5开户能办理吗?
Exemple Quelle est la relation entre le taux d'échantillonnage, l'échantillon et la durée?
吴恩达团队2022机器学习课程,来啦
Personal understanding of convolutional neural network
兄弟组件进行传值(显示有先后顺序)
星环科技数据安全管理平台 Defensor重磅发布
让更多港澳青年了解南沙特色文创产品!“南沙麒麟”正式亮相
Fix vulnerability - mysql, ES
Numerical calculation method chapter8 Numerical solutions of ordinary differential equations
访问数据库使用redis作为mysql的缓存(redis和mysql结合)
Eliminate the writing of 'if () else{}'
图像分类,看我就够啦!
New words new words new words new words [2]
通过SOCKS代理渗透整个内网
JDBC reads a large amount of data, resulting in memory overflow
Sophon CE社区版上线,免费Get轻量易用、高效智能的数据分析工具
[use electron to develop desktop on youqilin]