安装特定的PyTorch版本(pytorch == 1.0.1)

时间:2020-09-25 10:48:33

标签: macos pip pytorch conda

我正在尝试在conda env下安装特定的PyTorch版本:

使用点子:

pip3 install pytorch==1.0.1
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement pytorch==1.0.1 (from versions: 0.1.2, 1.0.2)
ERROR: No matching distribution found for pytorch==1.0.1

使用Conda:

conda install pytorch==1.0.1
    Collecting package metadata (current_repodata.json): done
    Solving environment: failed with initial frozen solve. Retrying with flexible solve.
    Collecting package metadata (repodata.json): done
    Solving environment: failed with initial frozen solve. Retrying with flexible solve.
    
    PackagesNotFoundError: The following packages are not available from current channels:
    
      - pytorch==1.0.1
    
    Current channels:
    
      - https://repo.anaconda.com/pkgs/main/osx-64
      - https://repo.anaconda.com/pkgs/main/noarch
      - https://repo.anaconda.com/pkgs/r/osx-64
      - https://repo.anaconda.com/pkgs/r/noarch
    
    To search for alternate channels that may provide the conda package you're
    looking for, navigate to
    
        https://anaconda.org
    
    and use the search bar at the top of the page.

我可以在https://anaconda.org/soumith/pytorch下找到该版本,但是有没有办法从控制台找到并安装?

2 个答案:

答案 0 :(得分:1)

您可以从官方Pytorch's Conda package下载/安装所需的版本。您指定的链接是旧版本,现在不支持/更新退出!!
像这样安装所需的版本:

conda install pytorch==1.0.1 torchvision==0.2.2 -c pytorch

如果您要查找pip版本,也可以从here查看和访问所有版本。

只需执行:

pip install torch===1.0.1 -f https://download.pytorch.org/whl/torch_stable.html

您也可以随时在此处检查previous versions

答案 1 :(得分:0)

您可以使用以下任一方法下载先前版本的 pytorch: 针对 Linux/Windows 特定操作系统

# CUDA 9.0
conda install pytorch==1.0.1 torchvision==0.2.2 cudatoolkit=9.0 -c pytorch

# CUDA 10.0
conda install pytorch==1.0.1 torchvision==0.2.2 cudatoolkit=10.0 -c pytorch

# CPU Only
conda install pytorch-cpu==1.0.1 torchvision-cpu==0.2.2 cpuonly -c pytorch 

访问此 website 以了解如何在您的特定操作软件上安装 pytorch 版本。我希望这个回答对您有所帮助。