【问题标题】:Include .whl installation in requirements.txt在 requirements.txt 中包含 .whl 安装
【发布时间】:2017-12-14 13:38:37
【问题描述】:

如何将其包含在 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 

【问题讨论】:

    标签: python pip pytorch requirements.txt


    【解决方案1】:

    你可以使用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。)

    【讨论】:

    • 假设我更新了一个包并运行 pip freeze> requirements.txt。现在我每次都必须手动添加它们。
    • 如果你依赖 PyPI 以外的东西,你就不能做得更好。你应该说服火炬手在那里发布他们的轮子。
    • @OrangeDog Meh,pipenv 试图做的太多了。
    • 它会安装一个 requirements.txt,然后为你输出一个冻结的文件,并保留轮子、git 链接、环境标记等。
    猜你喜欢
    • 2017-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-19
    • 2021-06-24
    • 1970-01-01
    相关资源
    最近更新 更多