在Pip需求文件(例如Git url)中使用符号and的语法是什么?

2024-09-27 07:28:04 发布

您现在位置:Python中文网/ 问答频道 /正文

在应用程序中使用&的正确语法是什么要求.txt?有逃跑的顺序吗?你知道吗

我在Git repo的子目录中有一个Python包。我可以使用pip成功地安装包(这里的语法:https://stackoverflow.com/a/26174655/6032073

但是,如果将Git URL放入要求.txt文件。我相信这是在破坏URL中的符号和字符(&;subdirectory=blah)

引号在需求文件中不起作用。用反斜杠和carot转义符号也不起作用(\&^&)。你知道吗

$ pip install 'git+ssh://git@github.example.com/reponame.git@branchname#egg=packagename&subdirectory=one/two'
[OK]

$ cat requirements.txt
"git+ssh://git@github.example.com/reponame.git@branchname#egg=pac..."

$ pip install -r requirements.txt 
RequirementParseError: Missing distribution spec "git+ssh://git@github.example.com/reponame.git@branchname#egg=packagename&subdirectory=one/two"  

更新

  • 我让它在中使用-e语法工作要求.txt(不需要引用)。没有-e这可能吗?你知道吗

Tags: pip文件gitgithubtxtcomurlegg

热门问题