Uncategorized

Why does “python” command start a new cmd window? – Python Help



I started a CMD window . Then when I typed ‘python’ to start the python interpreter, a new CMD window started, which is strange. Also, the ‘pip list’ command also started a new CMD window.
I have uninstall and reinstall python and also install other version including anaconda , They are doing the same thing.

AM using window 11

I have never seen this with the python.org versions of python.

Where exactly did you get the python version you have installed?

What is the output of py -0 ?

the pythion version was gotten from python.org
Anaconda from the main website too

you are starting new python interactive shell, so it’s not a cmd window. You can type valid python in it and it will be executed, unlike in a cmd.
Why specifically python interactive shell starts in a new window? Well, there could be a few reasons. First, if you try to run a python file from cmd, does it also start a new instance, or not?
Second, if you type python in the cmd, what happens?
Thrid, check in your PATH where py command is mapped to and what does it execute? Try to type “where py” and see what it prints

if you i run a python file from cmd, it does that too.
Any python command does that , they open new cmd prompt
Even typing just conda does that

,

i was not able to run any conda commands

ok, then what is the output of “where py” in the cmd?
Also, check if python executable is run as admin. It seems that if the user account is not “admin” and python.exe is configured to run as admin, it will always open a new window.

interesting, it seems windows has changed the structure quite a lot. Check if this file is configured to run with administrator rights. If it is, try turning it off.

i try changing python.exe to run as admin but it was not working
i also go to the regedit under each folder i look for any where .py folder is and delete .DONT KNOW WHY I DID THIS. Who knows somt might have get wrong from the regedit.

it kinda works now after i reinstall the python 3.8.5. But conda still not working

do you have a requirement for python 3.8? I would try the latest version, which is 3.12.1, unless you have some dependencies specifically on 3.8. Perhaps it could solve the issue.

Also see this Python script started as .\script.py runs in new window · Issue #18811 · PowerShell/PowerShell · GitHub

in that case the only things I can recommend are trying to remove “run as admin” from python executable and checking that you python file associations set up properly. If these don’t work, then I don’t know.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *