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

bash 复制代码
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
相关推荐
奈斯。zs12 分钟前
yjs08——矩阵、数组的运算
人工智能·python·线性代数·矩阵·numpy
Melody205013 分钟前
tensorflow-dataset 内网下载 指定目录
人工智能·python·tensorflow
学步_技术14 分钟前
Python编码系列—Python抽象工厂模式:构建复杂对象家族的蓝图
开发语言·python·抽象工厂模式
Narutolxy1 小时前
Python 单元测试:深入理解与实战应用20240919
python·单元测试·log4j
Amo Xiang1 小时前
2024 Python3.10 系统入门+进阶(十五):文件及目录操作
开发语言·python
liangbm31 小时前
数学建模笔记——动态规划
笔记·python·算法·数学建模·动态规划·背包问题·优化问题
B站计算机毕业设计超人2 小时前
计算机毕业设计Python+Flask微博情感分析 微博舆情预测 微博爬虫 微博大数据 舆情分析系统 大数据毕业设计 NLP文本分类 机器学习 深度学习 AI
爬虫·python·深度学习·算法·机器学习·自然语言处理·数据可视化
羊小猪~~2 小时前
深度学习基础案例5--VGG16人脸识别(体验学习的痛苦与乐趣)
人工智能·python·深度学习·学习·算法·机器学习·cnn
waterHBO4 小时前
python 爬虫 selenium 笔记
爬虫·python·selenium
编程零零七5 小时前
Python数据分析工具(三):pymssql的用法
开发语言·前端·数据库·python·oracle·数据分析·pymssql