I installed the pytorch properly, and I was using it without any problems with VScode.
But since yesterday, suddenly
import torch
ModuleNotFoundError: No module named 'torch'
An error occurs. But the strange thing is that it is imported from the jupyter notebook.
Is there any solution to the problem with VScode?
jupyter-notebook vscode
The problem is that the environment used by vcode and jupyter is different.
The path path you are referring to appears when you run in vscode as shown below. There should be a path that ends with site-packages. Go into the explorer and see if there is a torch.
In other words, if you do it on the jupyter, you'll be referring to the vcode and other places, and you can adjust it to the environment that the jupyter sees in the vcode environment.
import sys
print(sys.path)
© 2024 OneMinuteCode. All rights reserved.