问题-小技巧-python-一键装第三方库

有网但是没第三方环境的地方,能快速装上环境

代码:

python 复制代码
import os

print('开始安装模块...')
#os.system('pip install (在这敲上你需要装的库) -i https://pypi.tuna.tsinghua.edu.cn/simple')
os.system('pip install requests -i https://pypi.tuna.tsinghua.edu.cn/simple')
os.system('pip install pymysql -i https://pypi.tuna.tsinghua.edu.cn/simple')
os.system('pip install lxml  -i https://pypi.tuna.tsinghua.edu.cn/simple')
os.system('pip install BeautifulSoup4 -i https://pypi.tuna.tsinghua.edu.cn/simple')
os.system('pip install jsonpath  -i https://pypi.tuna.tsinghua.edu.cn/simple')
os.system('pip install urllib3==1.26.2 -i https://pypi.tuna.tsinghua.edu.cn/simple')
os.system('pip install selenium==3.141.0 -i https://pypi.tuna.tsinghua.edu.cn/simple')
os.system('pip install aiohttp -i https://pypi.tuna.tsinghua.edu.cn/simple')
os.system('pip install aiofiles -i https://pypi.tuna.tsinghua.edu.cn/simple')
os.system('pip install pymongo -i https://pypi.tuna.tsinghua.edu.cn/simple')
os.system('pip install redis -i https://pypi.tuna.tsinghua.edu.cn/simple')
os.system('pip install pytesseract -i https://pypi.tuna.tsinghua.edu.cn/simple')
os.system('pip install pillow -i https://pypi.tuna.tsinghua.edu.cn/simple')
os.system('pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple')
os.system('pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple')
print('所有模块安装完毕!')

可以编写自己所需要的第三方库列表,把这个python脚本拿到任何有python环境的地方都可以快速装自己所需要的第三方库

相关推荐
星火开发设计18 小时前
命名空间 namespace:解决命名冲突的利器
c语言·开发语言·c++·学习·算法·知识
小北方城市网18 小时前
RabbitMQ 生产级实战:可靠性投递、高并发优化与问题排查
开发语言·分布式·python·缓存·性能优化·rabbitmq·ruby
曲幽18 小时前
FastAPI部署中间件实战:从CORS到自定义,让你的API更健壮
python·fastapi·web·cors·starlette·middleware·call_next
爱学习的阿磊18 小时前
C++中的策略模式应用
开发语言·c++·算法
郝学胜-神的一滴18 小时前
Python中的bisect模块:优雅处理有序序列的艺术
开发语言·数据结构·python·程序人生·算法
Remember_99318 小时前
Spring 事务深度解析:实现方式、隔离级别与传播机制全攻略
java·开发语言·数据库·后端·spring·leetcode·oracle
看得见的风18 小时前
Claude Code + CCR配置(含OpenRouter、GLM、Kimi Coding Plan)
开发语言
L_090719 小时前
【Linux】进程状态
linux·开发语言·c++
roman_日积跬步-终至千里19 小时前
【Java并发】用 JMM 与 Happens-Before 解决多线程可见性与有序性问题
java·开发语言·spring
jackylzh19 小时前
PyTorch 2.x 中 `torch.load` 的 `FutureWarning` 与 `weights_only=False` 参数分析
人工智能·pytorch·python