Reputation: 15
Dear fellow humans and others,
i have a question about using and importing pytorch into my editor.
I installed pytorch through Conda and in my terminal editor I can use pytorch,see image
but not in Visual studio code or Pycharm!
No model named torch error code in VSC
Why is that?
Very sorry for the basic question and thank you for sparing some time!
Should I use pip?
Upvotes: 0
Views: 4905
Reputation: 10364
Reason: The environment where the module "torch
" is stored is not the environment you currently select in VSCode.
For installing and using the module "torch
" in VSCode, you could refer to the following:
Check the environment. The Python environment displayed in the lower left corner of VSCode is the same as that of the terminal.
Install the module. (pip install torch
)
Run.
Check the installation of the module. (pip show torch
)
Reference: Environment in VSCode.
Upvotes: 0
Reputation: 122
First, find out your python's path by writing which python
and then visit this page. You will change the project interpreter as the conda's python path. I recommend you to stick with pip but its your call, of course.
Upvotes: 1