Jak*_*ake 8 python pip python-3.x requirements.txt
我正在尝试使用从另一个网站下载的 pip 将以下安装命令转换为 requirements.txt 格式,但无法弄清楚如何。任何人都可以提供帮助吗?
pip install torch==1.5.0+cu101 torchvision==0.6.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html
pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu101/index.html
Run Code Online (Sandbox Code Playgroud)
Gin*_*pin 14
requirements.txt 文件的格式定义如下:
Run Code Online (Sandbox Code Playgroud)[[--option]...] <requirement specifier> [; markers] [[--option]...] <archive url/path> [-e] <local project path> [-e] <vcs project url>
在<requirement specifier>
定义了包和一个可选的版本。
Run Code Online (Sandbox Code Playgroud)SomeProject SomeProject == 1.3 SomeProject >=1.2,<2.0 SomeProject[foo, bar] SomeProject~=1.4.2
的--option
(如-f
/--find-links
)是一样的点子安装选项,如果你在干什么,你会使用pip install
命令行。
支持以下选项:
- -i, --index-url
- --extra-index-url
- --无索引
- -c, --约束
- -r, --要求
- -e, --editable
- -f, --find-links
- --无二进制
- --only-二进制
- --require-hash
- --pre
- --可信主机
因此,对于您的安装命令,requirements.txt 将如下所示:
[[--option]...]
<requirement specifier> [; markers] [[--option]...]
<archive url/path>
[-e] <local project path>
[-e] <vcs project url>
Run Code Online (Sandbox Code Playgroud)
确保验证链接的使用是否正确:
$ pip install -r requirements.txt
Looking in links: https://download.pytorch.org/whl/torch_stable.html, https://dl.fbaipublicfiles.com/detectron2/wheels/cu101/index.html
Collecting torch==1.5.0+cu101 (from -r requirements.txt (line 3))
Using cached https://download.pytorch.org/whl/cu101/torch-1.5.0%2Bcu101-cp38-cp38-linux_x86_64.whl
Collecting torchvision==0.6.0+cu101 (from -r requirements.txt (line 4))
Using cached https://download.pytorch.org/whl/cu101/torchvision-0.6.0%2Bcu101-cp38-cp38-linux_x86_64.whl
Collecting detectron2 (from -r requirements.txt (line 8))
Using cached https://dl.fbaipublicfiles.com/detectron2/wheels/cu101/detectron2-0.1.2%2Bcu101-cp38-cp38-linux_x86_64.whl
...
Run Code Online (Sandbox Code Playgroud)
作为旁注,您最初在标题中说“(不是 github)”。使用安装的默认包源pip
托管在 PyPi 上:https ://files.pythonhosted.org/ 。转到PyPi 中包的下载文件部分时,您可以看到实际链接(例如Torch)。
归档时间: |
|
查看次数: |
4338 次 |
最近记录: |