Install questions, Cannot import torchvision in pycharm (can import torch in pycharm), Cannot import both in IDLE


Hi, I have installed torchvison using ‘pip install --no-deps torchvision’ (pip3 install torchvision will cause error), but pycharm cannot import. pycharm can import torch correctly.
I have already installed anaconda. Both torch and torchvision cannot be imported in IDLE.

The paths are: ‘Requirement already satisfied: torchvision in c:\users*****\appdata\roaming\python\python37\site-packages (0.2.1)’
‘C:\Program Files (x86)\Python37-32\Scripts;C:\Program Files (x86)\Python37-32;’
The python in my computer is 3.7, and I installed anaconda with 3.6, will this be a problem. Isn’t anaconda with 3.6 the latest version?

(Pu Jiachen) #2

Since there’re so many Python distributions installed, I wonder whether these environments are messed up. Does pip and python come from the same Python distribution? You can check this through the following commands.

where python.exe
where pip.exe

As for IDLE, make sure you set it to the Python distribution that has PyTorch in it.


Thanks,the problem has been soloved. I installed python3.7 before anaconda, so there is the problem that python3.7 cannot use Torch and torchvision.
because of the python3.7, when I install torchvision using ‘pip install --no-deps torchvision’, torchvision seems not install correctly with anaconda. I think that is the reason I can not use torchvison.