No module named “Torch”

前端 未结 13 1022
慢半拍i
慢半拍i 2021-01-04 01:41

I installed pytorch via

conda install pytorch-cpu torchvision-cpu -c pytorch

And I also tried

pip3 install https://download.pytorch         


        
13条回答
  •  南笙
    南笙 (楼主)
    2021-01-04 02:16

    Try to install PyTorch using pip:

    First create a Conda environment using:

    conda create -n env_pytorch python=3.6
    

    Activate the environment using:

    conda activate env_pytorch
    

    Now install PyTorch using pip:

    pip install torchvision 
    

    Note: This will install both torch and torchvision.

    Now go to Python shell and import using the command:

    import torch
    import torchvision
    

提交回复
热议问题