0

When I installed the code runner extension and I can't run the python program this error popped up:

Image

Copyright © Microsoft Corporation. All rights reserved. 
Try the new cross-platform PowerShell https://aka.ms/pscore6 
Warning: PowerShell detected that you might be using a screen-reader and has disabled PSReadLine for compatibility purposes. 
If you want to re-enable it, run 'Import - Module PSReadLine'. 
PS C:\Users\Admin\OneDrive\Máy tính\py projects python -u " C\Users\ Admin\OneDrive\Máy tính\py project\test.py " python : The term 'python' is not recognized as the name of a cmdlet , function ,script file ,or operable program. Check the spelling of the name ,or if a path was included ,verify that the path is correct and try again. 
At line :1 char :1 
+ python -u " C:\Users\Admin\OneDrive\Máy tính\py project\test.py "  ' ~~~~~~
+ CategoryInfo : ObjectNotFound: (python:String) [], CommandNotException
+ FullyQualifiedErrorId : CommandNotFoundException

When I turned off the extension the code run normally, but when I turned on the error pop up. Thank you for reading my problem! ( •̀ ω •́ )✧

3
  • Do you have Python installed and on your PATH? Commented May 8, 2022 at 15:26
  • i have try to link on python path but it still doesn't work Commented May 8, 2022 at 15:29
  • @MattDMo but if i turn off the extension its working normal Commented May 8, 2022 at 15:44

2 Answers 2

1

What means "turn off the extension its working normal". According to the error report, this should be a problem with your Python environment variable setting. Have you tried the way named "Run Python File"? This is a function in extension pylance.

By the way, You should have installed the python extension.

enter image description here

updates:

enter image description here

You can use this option to run your python file. This is the file running option officially provided by Microsoft.

Sign up to request clarification or add additional context in comments.

6 Comments

Have you tired the way named "Run Python File"? This is a function in extension pylance. I haven't heard about way named "Run Python File" can you show details for me? Thank you btw. ヾ(≧▽≦*)o
According to the error report, this should be a problem with your Python environment variable setting Yes and then I reset the app, and it's working somehow :Đ???
@ruanhung_1802 I updated my reply. Of course, I prefer run python file to code-runner extension
@ MingJie-MSFT oh its workinggggggggggg thankss you so muchhhhh but i wonder if it has any shortcuts for this "run python file" ? (^▽^)
@ruanhung_1802 After you run it once, the triangle icon will use the method selected before by default. Of course, you can also set it in the shortcut key
|
1

Make sure you have python installed. IN the bottom left of VScode you have to pick an interpreter and make sure you select python. If you need to select your language, select python, and also name your file "FileName.py".

1 Comment

Yes, I have done it

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.