Python Python Basics Meet Python Syntax and Errors

Caleb Campbell
Caleb Campbell
5,747 Points

external text editor help

I am writing my code in Visual Studio code. How do I run 'hello.py' without having to copypasta my whole code into the python shell. I am in a windows environment just to let you all know.

Vixro Development
Vixro Development
707 Points

Hey, Caleb. Not sure if you have found your answer yet, but in case you haven't, this might help. Make a folder on your Desktop and call it something like "Python". Save the file to that folder. Now, press the windows key and r on your keyboard at the same time. When a new window pops up, type in cmd and press enter. Now navigate to the new folder using cd. If the folder is on your desktop, you can type this "cd desktop/python" and press enter. Now you can run the code using "python hello.py". Hope this helps!

2 Answers

Reese Lynn
Reese Lynn
973 Points

You do not have python installed on your computer. I have the same problem...

https://www.python.org/downloads/

you can download Python 3.7.1, as that is the latest version available now.

I recommend you download it in "C:\Users\Whoever". Open the file. Check "Add to PATH". Install it. When it finishes, open up a new command prompt and type "python"

if this doesn't work, try this: After you download it,

Go to the Start Menu Search for "control panel" Select "System and Security" Select "System" A dialog should pop up with a link on the left called "Advanced system settings". Click it.

In the System Properties dialog, click the button called "Advanced".

A dialog should pop up with a link on the left called "Environment Variables...". Click it.

In the Environment Variables dialog look for "Path" under the System Variables window.

Select it, then press "Edit...".

Add ";C:\Users\Whoever\python-3.7.1" to the end of it. The semicolon is the path separator on windows. DO NOT add a space before or after the semicolon, or else it will not work.

Click Ok and close the dialogs.

Now open up a new command prompt and type "python"

Hope this helps! :)

P.S. Sorry if I am very straight-forward, as I am very task oriented ;)

Caleb Campbell
Caleb Campbell
5,747 Points

yeah, no dice. 'python is not recognized as an internal or external command, operable program or batch file.'

Caleb Campbell
Caleb Campbell
5,747 Points

Looks like I'm using my RPi for now.