使用"-t"表示Requirements.txt文件中的选项 [英] Using "-t" option inside a requirements.txt file
问题描述
例如,当我有一个requirements-dev.txt
和requirements.txt
时,我知道我可以在requirements-dev.txt
内包含-r requirements.txt
,并且运行pip install -r requirements-dev.txt
会从这两个文件中安装软件包.
When I have, for example, a requirements-dev.txt
and a requirements.txt
, I know I can have -r requirements.txt
inside requirements-dev.txt
, for example, and running pip install -r requirements-dev.txt
would install packages from both files.
也就是说,我确定任何安装选项都可以在需求文件中正常工作.原来,当我在需求文件中放置类似以下内容的文件时:
That said, I was certain that any install option would work fine inside a requirements file. Turns out that when I place inside a requirements file something like:
mypackage==1.0.0 -t /path/to/local/dir
我得到:
pip: error: no such option: -t
正常工作.出于复杂的原因,我需要将多个程序包放在一个需求文件中,其中某些程序包必须针对一个目录,其他程序包必须针对另一个目录,依此类推.
while running pip install mypackage==1.0.0 -t /path/to/local/dir
works just fine. For complicated reasons, I need to place multiple packages in one requirements file, where some packages must target one directory, others must target another, and so goes on.
有什么解决方案可以做到这一点?
Any solutions to make this work?
推荐答案
pip install -r requirements.txt -t /path/to/install
这应该有效.它对我有用.
This should work. It worked for me.
如果要将不同的模块安装到不同的位置,那么我认为您可能必须将它们放入多个需求文本文件中.至少据我所知
If you want different modules to be installed to different locations, then I think you might have to put them into multiple requirements text files. This is at least as far as I know
这篇关于使用"-t"表示Requirements.txt文件中的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!