Today I run my python(.py) file as usual,but the terminal shows a new problem which I cannot solve for a long time. Explicitly,I used to click Run Python File,
but the terminal shows that like this:
I then tried another two ways to run my python,such as "run code"(code runner provides),debug(python plugin together with "run python file"),and it shows that: .
It is obvious that except the "debug",other two both fail to run,showing "ModuleNot..."(while actually the module exists in the vir env). All codes are easy:
print('Hello World')
import os
print(os.path.abspath(__file__))
import numpy as np
CodePudding user response:
Faced with the same issue.Solved by adding the following line
python.terminal.activateEnvironment" : false
to the settings.json file of the visual code
CodePudding user response:
go to vscode Extensions market and search "python". right click on "Python"(published by microsoft) and click on "Install another version". select a version that previously worked for you - usually just the one back before the current one.