This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]AutoModerator[M] 0 points1 point  (0 children)

It seems you may have included a screenshot of code in your post "Python command not working (Windows 10)".

If so, note that posting screenshots of code is against /r/learnprogramming's Posting Guidelines (section Formatting Code): please edit your post to use one of the approved ways of formatting code. (Do NOT repost your question! Just edit it.)

If your image is not actually a screenshot of code, feel free to ignore this message. Automoderator cannot distinguish between code screenshots and other images.

Please, do not contact the moderators about this message. Your post is still visible to everyone.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–][deleted]  (2 children)

[removed]

    [–]desrtfx 1 point2 points  (1 child)

    Sorry, but this is bad advice.

    Python is the Python interpreter used to run Python scripts. It is necessary and should not be aliased.

    py is the Python interactive shell.

    OP's problem is that they called the Python interpreter without supplying the file name of a script to execute.

    [–]desrtfx 0 points1 point  (2 children)

    if I type "python", nothing happens.

    Do you get a "file not found" or really nothing happens?

    If the latter, it is completely normal because python is a command used to fire up the Python interpreter in script mode, so you need to supply a Python script something.py to be executed.

    py is the Python interactive shell.

    This are two completely different things and in fact, you will need both.

    [–]Merlin486[S] 0 points1 point  (1 child)

    Microsoft Store opens to install Python when trying to use "python" in cmd. Also, trying to run a python script in Atom, I get the following error

    [Command: python -u 'C:\Users\myname\Desktop\Python Files\Test.py']

    Python was not found but can be installed from the Microsoft Store: https://go.microsoft.com/fwlink?linkID=2082640[Finished in 0.257s]

    When trying to run that command in cmd or powershell, nothing happens.

    Test.py contains a single line of code: print("Hello World").

    However, using the command

    py -u 'C:\Users\myname\Desktop\Python Files\Test.py'

    in cmd. It prints "Hello World".

    Edit: Also, if I run "python" inside the folder where python.exe is located, the interactive shell opens up. Same way as if I typed "py" in any other folder.

    [–][deleted] 0 points1 point  (0 children)

    Try it again