No module named “Torch”

前端 未结 13 976
慢半拍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:09

    Usually if the torch/tensorflow has been successfully installed, you still cannot import those libraries, the reason is that the python environment you try to import is not the python environment you installed.

    For example, if you have installed the torch/tensorflow using python='/usr/bin/python', then you cannot import them to python='/home/usrname/.../bin/python'.

    The solution is simple thus, just change the python and import again.

提交回复
热议问题