Re-installing Python many times

I am a complete newbee to this wonderfull code, and sometimes with AI help I was able to acomplish few things, but the problem that I encounter is this: made a code and works by double clicking on it, but other times I have to enter the usual Python -m name of file, and doesnt work saying that can´t find the path, then the AI tells me that I need to add the path to the variable something, and really gets complicated. So when I Re-install Python and libraries I get it to work again until happen again. Is there a way to fix this?

The AI seems to not be helpful for your problem.
This is an all too common situation with techinal, detailed, subjects.

Please share details of what you doing and what is happening.

At a guess the advice to use python -m <file-name> is wrong.
Likely you just need to use python <file-name>.
But as I say share details if that does not help.

1 Like

Thanks Barry Scott, I have being reading about Python since I posted my problem, there it says that we have to enter the path into the environment variable of windows, which I did with no results. What am I doing is very simple, installed Python and accepted to add the path, then I made a Python script located on the desktop, but when you doble click on, it says that cannot find the path. So, the solution is to open CMD with admin rights, and enter the whole path to were Python was install, in my case is:C:\Users\usuario\AppData\Local\Programs\Python\Python312\python.exe " plus the name of the file.py , if that doesn´t work you might have to add the path to the desktop.

It is optional to all python.exe to your windows environments PATH variable.

Recommand way to run python on windows is to use the py command which does not need you to edit the PATH.

Unless a script is designed to be GUI program double-clicking is not useful.
In a CMD type py path-to-script.
If the script in the desktop is macoga.py then this command in CMD.EXE terminal should run it:

py %userprofile%\Destktop\macoga.py

You may find this useful to read about python on windows: 4. Using Python on Windows — Python 3.12.4 documentation

1 Like

Thanks very much Barry Scott, didn’t know that being GUI you can doble click and will open, yeah the script is with GUI to ask a question from the user. Well I thought that both way should work, by double click or by the way you show me " py %userprofile%\Destktop\macoga.py", Anyway Barry, I download the whole Python documentation to read and understand a little bit more. Thanks again