当前位置: 首页 > news >正文

pycharm依赖管理(不要用pip freeze)

在使用python虚拟环境时,可以使用requirements.txt来管理当前项目的依赖。

注意,不要用  pip freeze > requirements.txt 这个命令,因为它会引入很多无关的包。

可以使用 pipreqs ./ --encoding=utf-8 

./ 表示当前项目的目录,--encoding=utf-8 是为了避免报错(编码相关)

Note Why to use pipreqs? Because pip freeze will collect all dependencies from the environments. While pipreqs will collect requirements used only in the current project!

pipreqs 生成的依赖就是你在项目中 import 的,但是可能会有遗漏(需要手动补全)

pycharm 自带的 sync 的原理和 pipreqs一致

下载包时 pip install -r requirements.txt 即可

可以使用 下面的命令来展示当前项目的依赖树:

pipdeptree --python D:\XXXX\venv\Scripts\python.exe

colorlog==6.8.0
└── colorama [required: Any, installed: 0.4.6]
concurrent-log==1.0.1
└── portalocker [required: >=1.5.2, installed: 2.8.2]└── pywin32 [required: >=226, installed: 306]
grpcio==1.31.0
└── six [required: >=1.5.2, installed: 1.16.0]
influxdb==5.3.0
├── msgpack [required: ==0.6.1, installed: 0.6.1]
├── python-dateutil [required: >=2.6.0, installed: 2.8.2]
│   └── six [required: >=1.5, installed: 1.16.0]
├── pytz [required: Any, installed: 2023.3.post1]
├── requests [required: >=2.17.0, installed: 2.31.0]
│   ├── certifi [required: >=2017.4.17, installed: 2023.11.17]
│   ├── charset-normalizer [required: >=2,<4, installed: 3.3.2]
│   ├── idna [required: >=2.5,<4, installed: 3.6]
│   └── urllib3 [required: >=1.21.1,<3, installed: 2.1.0]
└── six [required: >=1.10.0, installed: 1.16.0]
pandas==1.0.5
├── numpy [required: >=1.13.3, installed: 1.20.0]
├── python-dateutil [required: >=2.6.1, installed: 2.8.2]
│   └── six [required: >=1.5, installed: 1.16.0]
└── pytz [required: >=2017.2, installed: 2023.3.post1]
pip==22.3.1
protobuf==3.20.2
psutil==5.9.3
pyarrow==2.0.0
└── numpy [required: >=1.14, installed: 1.20.0]
pymysql-pool==0.3.7
└── PyMySQL [required: >=0.7.10, installed: 1.1.0]
redis==3.5.3
setuptools==65.5.1
wheel==0.38.4

http://www.lryc.cn/news/262138.html

相关文章:

  • [Kafka 常见面试题]如何保证消息的不重复不丢失
  • Java中System.setProperty()用法
  • Eclipse 自动生成注解,如果是IDEA可以参考编译器自带模版进行修改
  • 微信小程序vant安装使用过程中遇到无法构建npm的问题
  • [python]用python获取EXCEL文件内容并保存到DBC
  • Spring Boot 如何配置 log4j2
  • 如何安装docker
  • Linux 之 性能优化
  • 用Go汇编实现一个快速排序算法
  • Spring-整合MyBatis
  • sql宽字节注入
  • 开源 LLM 微调训练指南:如何打造属于自己的 LLM 模型
  • Android hilt使用
  • 2023/12/17 初始化
  • 【算法Hot100系列】三数之和
  • CSS 简介
  • myBatis-plus自动填充插件
  • 746. 使用最小花费爬楼梯 --力扣 --JAVA
  • 使用Verdaccio搭建私有npm仓库
  • 87 GB 模型种子,GPT-4 缩小版,超越ChatGPT3.5,多平台在线体验
  • Golang 数组 移除元素 双指针法 leetcode27 小记
  • c# OpenCV 图像裁剪、调整大小、旋转、透视(三)
  • Kafka相关知识
  • gitlab 通过svn hook 触发
  • 设计模式详解---单例模式
  • 毕设之-Hlang后端架构-双系统交互
  • 什么同源策略?
  • 破译模式:模式识别在计算机视觉中的作用
  • c语言-全局变量与局部变量
  • 【Spring】00 入门指南