Cannot import torch in anaconda at python3 but works in python2

I am using Mac and jupyter notebook(anaconda).

From the PyTorch website, I’ve tried to install PyTorch by:

conda install pytorch torchvision -c pytorch


pip3 install torch torchvision

When I import torch in jupyter notebook, the error shows:

ModuleNotFoundError: No module named 'torch'

However, in the terminal, if I enter python3 environment by: $ python3 , then import torch , there is no error.

Then I tried: conda list pytorch in the terminal, and found:

# Name                    Version                   Build  Channel
pytorch                   1.2.0                   py2.7_0    pytorch

So I finally notice in the jupyter notebook, if I use python2 and import torch, there would be no error. But I don’t know how to install pytorch in python3 environment? I’ve already followed the PyTorch website pip3 install torch torchvision , but it still not works.