How to specify pytorch as a package requirement on windows?

前端 未结 2 1498
时光说笑
时光说笑 2021-01-14 06:59

I have a python package which depends on pytorch and which I’d like windows users to be able to install via pip (the specific package is: https://github.com/mindsdb/lightwoo

2条回答
  •  伪装坚强ぢ
    2021-01-14 07:14

    For Windows, the installation can be done as follows:

    pip3 install torch===1.4.0 torchvision===0.5.0 -f https://download.pytorch.org/whl/torch_stable.html
    

    Here, you need to specify interested version. The -f is used to find links corresponding to the specific version on pytorch wheel page. You can use the direct link in requirements.txt file, which can be installed via pip as follows. For example, PyTorch 1.4, Python 3.7, Windows AMD64:

    # for torch
    https://download.pytorch.org/whl/cpu/torch-1.4.0%2Bcpu-cp37-cp37m-win_amd64.whl
    # for torchvision
    https://download.pytorch.org/whl/cpu/torchvision-0.5.0%2Bcpu-cp37-cp37m-win_amd64.whl
    

    The above links are for CPU, you can find the ones for CUDA as well.

    On the other hand, you can provide separate installation guide for Windows in your repository.

提交回复
热议问题