Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Can I Downgrade from Python 3.2 to 2.7?

I am trying to uninstall Python 3.2 and go back to 2.7, I do not have much experience with Python, and as I am learning now, it is becoming increasingly difficult to manage all of the work arounds needed to work with the newest version, and I require 2.7 for a college course.

I tried using the Windows 7 add/remove programs to uninstall Python 3.2 and 3.1, and then I downloaded and installed the 64 bit Python 2.7, but I was unable to open any of my already existing .py files with the executable in the Python27 folder.

When I click to open any .py file, I don't see any error messages but Windows asks what program to open the file with, and if I choose python.exe or pythonw.exe in C:\Python 27 I get a console Window appearing briefly and then closing. The "edit with IDLE" option in the context menu is gone, and if I try to edit with IdleX, I get another "what application to open with" window.

like image 587
womesiete Avatar asked Feb 12 '12 04:02

womesiete


3 Answers

Instead of removing python 3.2, you can use both of python 2 and 3 in the same time. You just need to specify which version you want to use.

When in CMD, you can see the available versions installed on your windows. If it doesn't appear there, you need to install it.

py -0 # Prints out the versions you can use.

You can specify which python version you want to use. For example in Windows 10, I use the code below for python 3.

py -3 fileName.py # runs using python 3

For python 2, you can use the code below after installing it.

py -2 fileName.py # Runs using python 2

Here is more information about installing more versions of Python in the same time. How to install both Python 2.x and Python 3.x in Windows 7

like image 100
Fatih Aktaş Avatar answered Oct 23 '22 15:10

Fatih Aktaş


Python 3.x is not backward compatible with Python 2.x, which was the purpose of the release. To clean up Python2.x without worrying about backward compatibility.

You can have as many python installations as you want on your computer, as they do not interact with each other. The python installations have it's own folder, with it's own idle, modules, launcher, ect.

like image 34
Ecker00 Avatar answered Oct 23 '22 13:10

Ecker00


You could install PyCharm or another Python IDE. It allows you to change which version of python you use to interpret your code. This will also identify syntax errors as you are writing and will notify you of them - in case you have code that works in 3.x but not 2.x.

Ecker00 is right, installing 2.7 in a separate directory gives you access to 2.7 while still having 3.x on your computer. You will have to re-install libraries with the Python27 folder's pip in order to use them in 2.7 though.

like image 1
jdanaher Avatar answered Oct 23 '22 13:10

jdanaher