当前位置:网站首页>Pytoch has been installed, but vs code still displays no module named 'torch‘
Pytoch has been installed, but vs code still displays no module named 'torch‘
2022-07-03 10:39:00 【serity】
Problem description
use conda The instruction creates a file called “pytorch” Environment , And installed Pytorch, Corresponding environment variables have also been added :
Besides ,VS Code Of Python Interpreter I have also switched to this environment :
But it always shows 
Solution
Because I have pretended Code Runner This plugin , And the culprit of this problem is Code Runner.
We first press ctrl+shift+P Open workspace settings ( If your python Settings are all in user settings , Then open user settings ), Find the following line 
And comment it out . Then the input “code-runner.executorMap” We will get the following large code :
"code-runner.executorMap": {
"javascript": "node",
"java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"php": "php",
"python": "python -u",
"perl": "perl",
"perl6": "perl6",
"ruby": "ruby",
"go": "go run",
"lua": "lua",
"groovy": "groovy",
"powershell": "powershell -ExecutionPolicy ByPass -File",
"bat": "cmd /c",
"shellscript": "bash",
"fsharp": "fsi",
"csharp": "scriptcs",
"vbscript": "cscript //Nologo",
"typescript": "ts-node",
"coffeescript": "coffee",
"scala": "scala",
"swift": "swift",
"julia": "julia",
"crystal": "crystal",
"ocaml": "ocaml",
"r": "Rscript",
"applescript": "osascript",
"clojure": "lein exec",
"haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",
"rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
"racket": "racket",
"scheme": "csi -script",
"ahk": "autohotkey",
"autoit": "autoit3",
"dart": "dart",
"pascal": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",
"d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt",
"haskell": "runhaskell",
"nim": "nim compile --verbosity:0 --hints:off --run",
"lisp": "sbcl --script",
"kit": "kitc --run",
"v": "v run",
"sass": "sass --style expanded",
"scss": "scss --style expanded"
}
We will
"python": "python -u"
In this line python -u Replace with installed pytorch Interpreter path in environment , namely :
"python": "G:\\anaconda3\\envs\\pytorch\\python.exe"
Save settings , restart VS Code that will do .
Reference resources
边栏推荐
- GAOFAN Weibo app
- Knowledge map reasoning -- hybrid neural network and distributed representation reasoning
- Ind kwf first week
- Ind wks first week
- Leetcode skimming ---217
- Leetcode刷题---202
- Leetcode skimming ---189
- I really want to be a girl. The first step of programming is to wear women's clothes
- Hands on deep learning pytorch version exercise solution-3.3 simple implementation of linear regression
- Leetcode刷题---283
猜你喜欢

深度学习入门之线性回归(PyTorch)

Out of the box high color background system

Realize an online examination system from zero

Powshell's set location: unable to find a solution to the problem of accepting actual parameters

Yolov5 creates and trains its own data set to realize mask wearing detection

Softmax 回归(PyTorch)

八、MySQL之事务控制语言

Softmax regression (pytorch)

User recommendation preference model based on attention enhanced knowledge perception

Tensorflow—Neural Style Transfer
随机推荐
Leetcode刷题---217
I really want to be a girl. The first step of programming is to wear women's clothes
Leetcode skimming ---278
Raspberry pie 4B deploys lnmp+tor and builds a website on dark web
Mysql5.7 installation and configuration tutorial (Graphic ultra detailed version)
七、MySQL之数据定义语言(二)
Leetcode刷题---977
CSDN, I'm coming!
EFFICIENT PROBABILISTIC LOGIC REASONING WITH GRAPH NEURAL NETWORKS
Rewrite Boston house price forecast task (using paddlepaddlepaddle)
Leetcode skimming ---10
熵值法求权重
Leetcode skimming ---1385
深度学习入门之线性回归(PyTorch)
Ut2013 learning notes
Tensorflow—Neural Style Transfer
Multilayer perceptron (pytorch)
神经网络入门之模型选择(PyTorch)
Ind wks first week
Leetcode skimming ---852