#πŸ”’ What does the py command actually do in Windows Command Prompt?

22 messages Β· Page 1 of 1 (latest)

paper peak
#

I know that without any arguments it starts a repl inside of the terminal but is it a path, because the alternative is python, which to my knowledge is a path.

desert fernBOT
#

@paper peak

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

hollow forge
#

It's a separate executable that eventually calls (some version of) python. Very handy.

#

(also, not sure what you mean by "is a path")

paper peak
hollow forge
#

Sure, that works the same way, there's a py.exe in one of the folders in your PATH

#

(that's how all console commands work - when you type a command, unless it is built into your terminal like cd, its name is looked up in PATH and whatever executable found is ran)

stark ridge
paper peak
#

so theres no info on the python one

#

but the py is located under windows folder

stark ridge
paper peak
#

should I? i've heard its bad for multiple versions

true locust
#

I'll always have my "main" Python version on PATH so I can install libraries that have their own commands (like black, or ipython, or pyinstaller) and they'll just work.

#

I don't think it's bad as long as you know what you're doing

#

You can still access other versions with py

#

You also don't need to do that though

paper peak
#

is it the path to a file?

civic pivot
#

With the "py.exe" command you can execute a particular version of python that you have previously installed. For example, if you have Python 3.10 installed and later install Python 3.12 alongside it, you can use the command "py.exe -3.10 my_script.py" to have my_script.py run under the 3.10 interpreter, even if Python 3.12 is the one that runs by default when you use "python.exe". This is useful if my_sctipt.py has dependencies on libraries that are installed under 3.10 but not 3.12.

desert fernBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.