在 requirements.txt 中包含 .whl 安装

Include .whl installation in requirements.txt

如何将其包含在 requirements.txt 文件中? 对于 Linux:

pip install http://download.pytorch.org/whl/cu75/torch-0.1.12.post2-cp27-none-linux_x86_64.whl 
pip install torchvision

对于 MacOS:

pip install http://download.pytorch.org/whl/torch-0.1.12.post2-cp27-none-macosx_10_7_x86_64.whl 
pip install torchvision 

您可以使用 environment markers:

http://download.pytorch.org/whl/cu75/torch-0.1.12.post2-cp27-none-linux_x86_64.whl ; sys_platform == "linux"
http://download.pytorch.org/whl/cu75/torch-0.1.12.post2-cp27-none-linux_x86_64.whl ; sys_platform == "linux2"
http://download.pytorch.org/whl/torch-0.1.12.post2-cp27-none-macosx_10_7_x86_64.whl ; sys_platform == "darwin"
torchvision

(双 Linux 条目:linux2 用于 Python 2,linux 用于 Python 3。)