After installing torch on Linux, an error is still reported: importerror: no module named torch

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

Error still reported after installing torch on Linux:

Traceback (most recent call last):
  File "", line 58, in <module>
    import torch
ImportError: No module named torch 

The reason is that you have to configure the environment:

First enter:

vim ~/.bashrc

Add the following statement:

. /home/yourdirectory/torch/install/bin/torch-activate
# added by Anaconda3 installer
export PATH="/home/yourdirectory/anaconda3/bin:$PATH"

Then update the environment variable

source ~/.bashrc

Similar Posts: