当前位置:网站首页>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
边栏推荐
- Are there any other high imitation projects
- conda9.0+py2.7+tensorflow1.8.0
- Preliminary knowledge of Neural Network Introduction (pytorch)
- Leetcode skimming ---75
- 深度学习入门之线性回归(PyTorch)
- Softmax 回归(PyTorch)
- Hands on deep learning pytorch version exercise solution - 2.5 automatic differentiation
- Yolov5 creates and trains its own data set to realize mask wearing detection
- Leetcode刷题---367
- Ut2016 learning notes
猜你喜欢

Ind wks first week

High imitation Netease cloud music

【吐槽&脑洞】关于逛B站时偶然体验的弹幕互动游戏魏蜀吴三国争霸游戏的一些思考

Model evaluation and selection

权重衰退(PyTorch)

Pytorch ADDA code learning notes

Timo background management system

Data classification: support vector machine

ThreadLocal principle and usage scenario

Convolutional neural network (CNN) learning notes (own understanding + own code) - deep learning
随机推荐
Ut2015 learning notes
MySQL reports an error "expression 1 of select list is not in group by claim and contains nonaggre" solution
Leetcode刷题---75
ThreadLocal principle and usage scenario
Secure in mysql8.0 under Windows_ file_ Priv is null solution
六、MySQL之数据定义语言(一)
[LZY learning notes -dive into deep learning] math preparation 2.1-2.4
Raspberry pie 4B installs yolov5 to achieve real-time target detection
Multi-Task Feature Learning for Knowledge Graph Enhanced Recommendation
6、 Data definition language of MySQL (1)
Leetcode刷题---852
Are there any other high imitation projects
Leetcode skimming ---263
mysql5.7安装和配置教程(图文超详细版)
Raspberry pie 4B deploys lnmp+tor and builds a website on dark web
Leetcode skimming ---977
Leetcode刷题---1
Common scenarios in which Seata distributed transactions fail and do not take effect (transactions do not rollback)
Ut2013 learning notes
I really want to be a girl. The first step of programming is to wear women's clothes