玩转一下Python
Opened this issue · 1 comments
bingoohuang commented
bingoohuang commented
pipenv
集成了pip
,virtualenv
两者的功能,且完善了两者的一些缺陷。
pipenv 是 Pipfile 主要倡导者、requests 作者 Kenneth Reitz 写的一个命令行工具,主要包含了Pipfile、pip、click、requests和virtualenv,能够有效管理Python多个环境,各种第三方包及模块。
- 用virtualenv管理requirements.txt文件可能会有问题,Pipenv使用Pipfile和Pipfile.lock,后者存放将包的依赖关系,查看依赖关系是十分方便。
- 各个地方使用了哈希校验,无论安装还是卸载包都十分安全,且会自动公开安全漏洞。
- 通过加载.env文件简化开发工作流程。
- 支持Python2 和 Python3,在各个平台的命令都是一样的。
🕙[2020-09-14 11:19:49.761] ❯ brew install pipenv
Updating Homebrew...
Warning: pipenv 2020.8.13 is already installed and up-to-date
To reinstall 2020.8.13, run `brew reinstall pipenv
A thoroughly biased feature table
Name | Pip + venv | Pipenv | Poetry | pyenv | pythonloc | Conda | this |
---|---|---|---|---|---|---|---|
Manages dependencies | ✓ | ✓ | ✓ | ✓ | ✓ | ||
Resolves/locks deps | ✓ | ✓ | ✓ | ✓ | |||
Manages Python installations | ✓ | ✓ | ✓ | ||||
Py-environment-agnostic | ✓ | ✓ | ✓ | ||||
Included with Python | ✓ | ||||||
Stores deps with project | ✓ | ✓ | ✓ | ||||
Requires changing session state | ✓ | ✓ | |||||
Clean build/publish flow | ✓ | ✓ | |||||
Supports old Python versions | with virtualenv | ✓ | ✓ | ✓ | ✓ | ✓ | |
Isolated envs for scripts | ✓ | ||||||
Runs project fns from CLI | ✓ | ✓ | ✓ |