I went to Anaconda Prompt (32-bit) and got a prompt “(base)”. There I entered the command “conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch”. After 5-10 minutes, I got the message “The following packages are not available from current channels: cudatoolkit=10.2, pytorch, torchaudio”. I was suggested to look at other “channels”. Am I supposed to do something else? This is not explained.
In case you are using a 32bit Python environment, update to 64bit Python and try to install PyTorch again.
I did install the 64bit Python environment and was successful in importing torch. In addition, I had installed Anaconda3 and went to its prompt, where I was also able to import torch. Thus, there are two methods.