0

When I put "py --list" in the terminal I get this:

Installed Pythons found by C:\Windows\py.exe Launcher for Windows
No Installed Pythons Found!

I set my environment variables. I actually got VS Code to run some code I threw together that didn't use any imports, but now that I'm trying to use any python commands in the terminal, I'm getting errors. What gives?

python should work, since it is finding installations.

starball
  • 20,030
  • 7
  • 43
  • 238
Paul
  • 1
  • you should make sure the python extension is installed in vsCode. Additionally, you should set the interpreter. Do do this: ctrl + shift + p and then type "Python: Select Interpreter" and add the corresponding path – i regular Feb 09 '23 at 15:59
  • hmmm, is it related to this? https://stackoverflow.com/questions/52332554/vscode-the-term-python-is-not-recognized-but-py-works – i regular Feb 09 '23 at 16:08
  • I guess not. I have PATH referencing both python and it's script folder. I guess I can reinstall both py and vs since they are apparently nonfunctional. – Paul Feb 09 '23 at 19:22
  • which type of terminal are you using? Can you run python or the py launcher from a command prompt or powershell session outside of VSCode? – nigh_anxiety Feb 09 '23 at 20:59
  • If you run the following `import sys; print(sys.executable)` in VS Code what do you get? – Steven Summers Feb 10 '23 at 01:34
  • cant post full error, but both import and sys.executable throw up errors. – Paul Feb 10 '23 at 17:05

2 Answers2

0

If you are working on Windows, very often it's all about permissions. Try running your terminal and VSCode as administrator! Worked a lot of times for me, also with other languages.

0

Please ensure that you have installed the python extension and selected the correct python interpreter (Ctrl+Shift+P and type Python: Select Interpreter).

If this didn't work, you may have to reinstall python.

Read the document about Vscode-Python for more details.

MingJie-MSFT
  • 5,569
  • 1
  • 2
  • 13
  • Thanks for reply, will reinstalling really help though? I just installed it on this machine yesterday. I should point out that when I go to select interpreter it finds my python path. I am able to compile and run python, but actually using it in terminal in vsCode doesn't work (cmd.exe works fine) – Paul Feb 10 '23 at 17:05
  • Can this work if you add `"terminal.integrated.defaultProfile.windows": "Command Prompt",` to your **user settings**? – MingJie-MSFT Feb 13 '23 at 01:12