Ubuntu的jupyter notebook中出现"No module named torch"的解决方法

今天给一个新账号安装了anaconda,并新建了一个虚拟环境,安装了pytorch,但打开ipython或jupyter notebook之后却发现import torch时会报错。多方查找之后找到了解决方案:

https://github.com/pytorch/pytorch/issues/4827#issuecomment-405589084

主要就是这个人说的,必须要在base环境和你新建的这个环境两个环境中都`conda install jupyter`。我刚开始在网上看到的只在新建的环境里面`conda install jupyter`,结果问题并未解决;在base环境里也`conda install jupyter`之后,问题解决了,在ipython和jupyter notebook里都能够成功import torch了。

 


版权声明:本文为monchin原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。