当前位置:网站首页>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
边栏推荐
- Judging the connectivity of undirected graphs by the method of similar Union and set search
- Leetcode skimming ---1
- Leetcode skimming ---283
- Notes - regular expressions
- 六、MySQL之数据定义语言(一)
- Hands on deep learning pytorch version exercise solution-3.3 simple implementation of linear regression
- Leetcode刷题---977
- [SQL] an article takes you to master the operations related to query and modification of SQL database
- Practical part: conversion of Oracle Database Standard Edition (SE) to Enterprise Edition (EE)
- Leetcode skimming ---1385
猜你喜欢
七、MySQL之数据定义语言(二)
High imitation wechat
【吐槽&脑洞】关于逛B站时偶然体验的弹幕互动游戏魏蜀吴三国争霸游戏的一些思考
Configure opencv in QT Creator
High imitation bosom friend manke comic app
Hands on deep learning pytorch version exercise solution - 2.6 probability
An open source OA office automation system
Out of the box high color background system
Tensorflow—Neural Style Transfer
What did I read in order to understand the to do list
随机推荐
ThreadLocal principle and usage scenario
[LZY learning notes -dive into deep learning] math preparation 2.5-2.7
Ut2014 supplementary learning notes
Leetcode刷题---1
Advantageous distinctive domain adaptation reading notes (detailed)
Leetcode skimming ---852
High imitation wechat
Ind kwf first week
A complete answer sheet recognition system
Drop out (pytoch)
[LZY learning notes -dive into deep learning] math preparation 2.1-2.4
6、 Data definition language of MySQL (1)
MySQL reports an error "expression 1 of select list is not in group by claim and contains nonaggre" solution
Leetcode刷题---977
Hands on deep learning pytorch version exercise solution - 2.6 probability
Model selection for neural network introduction (pytorch)
Leetcode skimming ---35
Inverse code of string (Jilin University postgraduate entrance examination question)
[graduation season] the picture is rich, and frugality is easy; Never forget chaos and danger in peace.
Raspberry pie 4B installs yolov5 to achieve real-time target detection