【问题标题】:Is Poetry install the package when we do poetry add?当我们添加诗歌时,诗歌是否安装了软件包?
【发布时间】:2022-03-24 16:24:00
【问题描述】:

我是 Poetry 的新手,不知何故,阅读网络上的文档并不能真正帮助我理解这个工具。 所以,我有没有使用诗歌的现有项目,我想使用 pip 中的requirements.txt 编写pyproject.tomlpoetry.lock 文件,以使其他人更容易产生我的结果。为此,我使用命令:

诗歌添加'cat requirements.txt'

但是当命令运行时,Poetry 似乎又在安装包了。任何人都可以向我解释一下吗?谢谢

命令结果如下:

$ poetry add `cat requirements.txt`
Using version ^1.21.2 for numpy
Using version ^0.46 for olefile
Using version ^8.3.2 for Pillow
Using version ^3.10.0 for typing-extensions

Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 35 installs, 0 updates, 0 removals

  • Installing colorama (0.4.4)
  • Installing catalogue (2.0.6)
  • Installing click (8.0.3)
  • Installing cymem (2.0.5)
  • Installing numpy (1.21.2)
  • Installing typing-extensions (3.10.0.2)
  • Installing blis (0.7.4)
  • Installing certifi (2021.10.8)
  • Installing charset-normalizer (2.0.7)
  • Installing idna (3.2)
  • Installing preshed (3.0.5)
  • Installing smart-open (5.2.1)
  • Installing srsly (2.4.1)
  • Installing pyparsing (2.4.7)
  • Installing pydantic (1.8.2)
  • Installing urllib3 (1.26.7)
  • Installing typer (0.4.0)
  • Installing wasabi (0.8.2)
  • Installing markupsafe (2.0.1)
  • Installing fastrlock (0.6)
  • Installing packaging (21.0)
  • Installing pathy (0.6.0)
  • Installing jinja2 (3.0.2)
  • Installing spacy-legacy (3.0.8)
  • Installing torch (1.8.0)
  • Installing thinc (8.0.10)
  • Installing tqdm (4.62.3)
  • Installing pillow (8.3.2)
  • Installing requests (2.26.0)
  • Installing cupy-cuda111 (9.5.0)
  • Installing olefile (0.46)
  • Installing torchtext (0.9.0)
  • Installing spacy (3.1.3)
  • Installing torchvision (0.9.0)
  • Installing torchaudio (0.8.0)

【问题讨论】:

    标签: python pip dependencies python-poetry


    【解决方案1】:

    是!!poetry add pckg会自动找到合适的版本约束,安装包和子依赖。

    如果您有关于如何将 requirements.txt 与诗歌一起使用的问题:

    从 Poetry config 创建一个 requirements.txt 文件

    poetry export -f requirements.txt --output requirements.txt
    

    poetry export -f requirements.txt > requirements.txt
    

    poetry export --output requirements.txt
    

    从 requirements.txt 导入诗歌

     poetry add `cat requirements.txt`
    

     poetry add $( cat requirements.txt )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-11
      • 2021-06-13
      • 1970-01-01
      • 1970-01-01
      • 2022-08-06
      • 1970-01-01
      • 1970-01-01
      • 2021-12-13
      相关资源
      最近更新 更多