Python理解pip、pipfile、pipenv、requirements.txt

  • what is pipfile

    From pipfile: the replacement for requirements.txt ,Pipfile and its sister Pipfile.lock are a replacement for the existing standard pip's requirements.txt file.

    From PyCharm Use pipfile, Pipfile is the dedicated file used by the Pipenv virtual environment to manage project dependencies. This file is essential for using Pipenv. When you create a Pipenv environment either for a new or an existing project, the Pipfile is generated automatically.

  • requirements.txt

    文本文件,列出所有需要安裝的模塊,通過pip install -r requirements.txt 一次性安裝。

  • pipfile

    From Real Python, the syntax for the Pipfile is TOML, and the file is separated into sections.:

    1. [dev-packages] for development-only packages
    2. [packages] for minimally required packages
    3. [requires] for other requirements like a specific version of Python
  • pipfile.lock

    提供版本鎖支持

    pip freeze -p Pipfile # 生成Pipfile.lock
    
  • pippipenv

    pip是python distribution官方標準庫,pipenv是Python Packaging User Guide(PyPA)官方推薦的。

    經常看到很多地方都說是官方,其實不是一個主體。

    Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. Windows is a first-class sitizen, in our world. (About First-class citizen)

  • References

  1. pip 與 Pipfile
  2. How are Pipfile and Pipfile.lock used?
  3. Pipenv: A Guide to the New Python Packaging Tool
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章