python跨版本包管理方案(pyenv + pipenv)
Python 管理 版本 方案
2023-09-27 14:28:36 时间
背景
通过对pyenv的探索,已经掌握pyenv对python多版本的管理方法。
同时pyenv可以集成virtualenv,实现多项目需求的独立环境的搭建,
from(https://github.com/pyenv/pyenv-virtualenv)
问题是,对于项目的管理, 我们缺少一个依赖的配置清单,类似 node的 package.json
这个可以通过pip freeze来生成requirement.txt文件解决。
但是这个方法,具有一些问题,每次pip install后,需要主动调用pip freeze来更新配置清单。
针对这个问题,
于是pipenv闪亮出场
https://pipenv.pypa.io/en/latest/
针对新的安装包, 只需要 pipenv install xxx, 就可以将新的文件更新到 pipfile中。
体验跟node的npm类似。
于是针对包管理的角度, 我们引入新的python跨版本包管理方案
pyenv + pipenv
pyenv -- 跨python版本的os环境管理。
pipenv -- 跨多个项目的运行环境管理。
pyenv
https://github.com/pyenv/pyenv
pyenv does...
- Let you change the global Python version on a per-user basis.
- Provide support for per-project Python versions.
- Allow you to override the Python version with an environment variable.
- Search commands from multiple versions of Python at a time. This may be helpful to test across Python versions with tox.
pipenv
https://pipenv.pypa.io/en/latest/
The problems that Pipenv seeks to solve are multi-faceted:
- You no longer need to use
pip
andvirtualenv
separately. They work together.- Managing a
requirements.txt
file can be problematic, so Pipenv usesPipfile
andPipfile.lock
to separate abstract dependency declarations from the last tested combination.- Hashes are used everywhere, always. Security. Automatically expose security vulnerabilities.
- Strongly encourage the use of the latest versions of dependencies to minimize security risks arising from outdated components.
- Give you insight into your dependency graph (e.g.
$ pipenv graph
).- Streamline development workflow by loading
.env
files.
相关文章
- python Anaconda 安装管理包,开发环境
- 软件测试学什么?我从功能测试到Python自动化测试的进阶之路......
- python os&shutil 文件操作
- 复盘:Python内存管理&垃圾回收原理
- Ansible权威指南 》一1.8 Python多环境扩展管理
- Python编程-基础知识-python项目包和文件的管理以及如何引用相对路径的包和模块
- 《Python高手之路》——2.6 管理API变化
- 「基于Python技术的智慧中医商业项目」问诊模块后台管理
- Python基础必掌握的pip管理依赖项
- python如何进行内存管理
- 《Python语言程序设计》——1.7 程序设计风格和文档
- python之Map函数
- 管理软件 食品检测 药品检测 专业化的管理软件设计与实施8 检测工作进度 python
- 管理软件 食品检测 药品检测 专业化的管理软件设计与实施10 客户管理 python
- 【LeetCode】【Python题解】Reverse Integer
- 使用 Python Poetry 进行依赖管理