当前位置:网站首页>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
边栏推荐
猜你喜欢

Ut2012 learning notes

Policy Gradient Methods of Deep Reinforcement Learning (Part Two)

神经网络入门之矩阵计算(Pytorch)

Handwritten digit recognition: CNN alexnet

Configure opencv in QT Creator

Advantageous distinctive domain adaptation reading notes (detailed)

侯捷——STL源码剖析 笔记

C#项目-寝室管理系统(1)

A super cool background permission management system

Model evaluation and selection
随机推荐
Leetcode刷题---283
Binary search method
Preliminary knowledge of Neural Network Introduction (pytorch)
Ind kwf first week
Hands on deep learning pytorch version exercise solution - 3.1 linear regression
Leetcode skimming ---704
Practical part: conversion of Oracle Database Standard Edition (SE) to Enterprise Edition (EE)
Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported
Leetcode skimming ---832
The story of a 30-year-old tester struggling, even lying flat is extravagant
Drop out (pytoch)
C project - dormitory management system (1)
深度学习入门之线性代数(PyTorch)
Hands on deep learning pytorch version exercise solution - 2.3 linear algebra
Automatic derivation of introduction to deep learning (pytoch)
2018 y7000 upgrade hard disk + migrate and upgrade black apple
Boston house price forecast (tensorflow2.9 practice)
Out of the box high color background system
High imitation bosom friend manke comic app
Hands on deep learning pytorch version exercise solution - 2.6 probability