Python生成、安装requirements.txt依赖

mervyn 2019年11月11日13:49:11编程语言 PythonPython生成、安装requirements.txt依赖已关闭评论1353

目录

生成 requirements.txt

pip 方式

Usage:
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  config                      Manage local and global configuration.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  help                        Show help for commands.

pip listpip freeze 命令可以查看已安装的包。文章源自编程技术分享-https://mervyn.life/33a69c73.html

pip list

➜  ~ pip list
Package           Version
----------------- ----------
amqp              2.3.2
asn1crypto        0.24.0
astroid           2.1.0
autopep8          1.4.4
bcrypt            3.1.6
billiard          3.5.0.5
certifi           2018.11.29
cffi              1.12.3
cli-helpers       1.2.0
pip list --format=freeze > requirements.txt

pip freeze

➜  ~ pip freeze
amqp==2.3.2
asn1crypto==0.24.0
astroid==2.1.0
autopep8==1.4.4
bcrypt==3.1.6
billiard==3.5.0.5
certifi==2018.11.29
cffi==1.12.3
pip freeze > requirements.txt

pipreqs

pipreqs 可以用来查找项目依赖并生成requirements.txt文章源自编程技术分享-https://mervyn.life/33a69c73.html

pip install pipreqs
pipreqs application_path

安装 requirements.txt 中的依赖

pip install -r requirements.txt
文章源自编程技术分享-https://mervyn.life/33a69c73.html
weinxin
我的微信公众号
微信扫一扫
mervyn
python多版本及依赖包管理 Python

python多版本及依赖包管理

本文主要讲述如何通过 pyenv 来管理不同版本的 python ,以及如何使用 Pipenv 在同一个python版本实现项目之间依赖包的隔离。 pyenv Linux下安装 curl https:...
使用 pipenv 管理依赖包 Python

使用 pipenv 管理依赖包

之前文章提到了使用 pyenv 和 pyenv-virtualenv 管理python环境,那环境搭建ok了,接下来在做项目的过程难免需要用到各种依赖包。 以前经常用的就是 EasyInstall 来...
python多版本及依赖包管理 Python

python多版本及依赖包管理

本文主要讲述如何通过 pyenv 来管理不同版本的 python ,以及如何使用 Pipenv 在同一个python版本实现项目之间依赖包的隔离。 pyenv Linux下安装 curl https:...