linux上安装完torch后仍报错:ImportError: No module named torch

linux上安装完torch后仍报错:

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

是因为还要进行环境配置:

首先进入:

vim ~/.bashrc

添加下面的语句:

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

然后更新一下环境变量就可以了

source ~/.bashrc

 

posted @ 2019-03-19 16:15  慢行厚积  阅读(9289)  评论(0编辑  收藏  举报