SOLVED Python 3.6 wont run .py programs

Joined
Mar 17, 2017
Messages
4
Reaction score
0
I recently picked up python as a hobby and found it quite interesting. Then I found a program online I thought I'd try out. After realising it was a 2.x program I went to python.org and downloaded it. All was good and well until I tried to run my 3.6 programs. My computer automatically went to 2.x, this wasnt really a problem since I could just use the open in function, but when I tried I just got the modify setup screen. No matter what I did nothing would make it run again. I have tried to delete all traces of python 2.x and deleting and reinstalling 3.6, but I get the same result. Any ideas? BTW I can still run everything in the command prompt.
 

Attachments

  • Modify setup python.PNG
    Modify setup python.PNG
    180.3 KB · Views: 946

Regedit32

Moderator
Joined
Mar 4, 2016
Messages
3,617
Reaction score
1,139
Hi anwaol,

Welcome to the Forum.

If you open an Administrator Command Prompt console and type echo %path% then press Enter key do you see C:\Program Files\Python 3.6 listed among your PATH variables or the 2.0 version?

That may be what is going on here.

The installer for Python ought to have a box you need to check that sets the PATH variable as it installs. Have you checked that box during installation?

By way of an experiment you could set the PATH and PYTHONPATH temporarily then run Python from the command console which will then inherit these new settings to test whether it works.

In the Administrator Command Console simply enter the following:

Code:
C:\>set PATH=C:\Program Files\Python 3.6;%PATH%

Press Enter key to execute

Code:
C:\>set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib

Press Enter key to execute

Code:
C:\>python

Press Enter key to open Python so it can inherit these temporary settings.

Regards,

Regedit32
 
Joined
Mar 17, 2017
Messages
4
Reaction score
0
Hi anwaol,

Welcome to the Forum.

If you open an Administrator Command Prompt console and type echo %path% then press Enter key do you see C:\Program Files\Python 3.6 listed among your PATH variables or the 2.0 version?

That may be what is going on here.

The installer for Python ought to have a box you need to check that sets the PATH variable as it installs. Have you checked that box during installation?

By way of an experiment you could set the PATH and PYTHONPATH temporarily then run Python from the command console which will then inherit these new settings to test whether it works.

In the Administrator Command Console simply enter the following:

Code:
C:\>set PATH=C:\Program Files\Python 3.6;%PATH%

Press Enter key to execute

Code:
C:\>set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib

Press Enter key to execute

Code:
C:\>python

Press Enter key to open Python so it can inherit these temporary settings.

Regards,

Regedit32

Hey,

thank you!

When I did as you said I found that it is infact set to 2.0 version. I did install the path when I downloaded py 3.6 though. How would i go about fixing this? As I can't seem to find any trace of 2.0.
 

Regedit32

Moderator
Joined
Mar 4, 2016
Messages
3,617
Reaction score
1,139
Hi anwaol,

The simplest thing to do at this point would be uninstall Python 2 and 3.6 first.

Next run the 3.6 installer again.

As soon as the installer opens check the box next to Add Python 3.6 to PATH

Sample image
python.png


Now simply click on Install Now

Regards,

Regedit32
 
Joined
Mar 17, 2017
Messages
4
Reaction score
0
Hello again,

I did add it to PATH the first time, the scripts run fine in the command prompt, no problems there. My problem is that if I open it directly, by dobblepressing the file on for example my desktop, it won't open or run, this is when I get the modify setup screen.

I will try anyway, to do it from scratch. As you said it's probably the best thing to do at this point.
I'll return with results.

Thank you again.
 
Joined
Mar 17, 2017
Messages
4
Reaction score
0
Good news.

Reinstalling made me look again, and see that I somehow have managed to tell my computer to open .py files in the modify window. Problem now solved.

Thank you for making me look again, and thak you for great & fast help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top