I have both python38,37 and anaconda installed, OS - win10,x64.
I could not install torch in py38,37 - but installed it in anaconda.
system env var 'Path' has:
In vscode, despite that i have selected interpreter as Python 3.8.3 base-conda
I still can't import torch. But when using jupyter notebook, I can import torch:
import torch
print(torch.__path__)
['C:\\anaconda3\\lib\\site-packages\\torch']
How to import torch in vs code and choose the right interpreter?
When we import the module, we need to install the required module in the currently selected environment.(Python environments.)
I installed it in the base conda environment using the following statement:
conda install pytorch torchvision -c pytorch
We need to pay attention to the selected kernel in Jupyter Notebook:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With