Can I Have Python 2 And 3 Installed?

If you use Python you probably are aware of the many updates and versions you can get, however, can you have two versions of Python on the same device?

Well, yes, of course you can. But how? This is what we will talk to you about today.

There is much to learn about how you can use Python, but if you want to have Python 2 and Python 3 installed on the same device then you are in the right place.

Let’s not beat around the bush, let’s get started.

Advertising links are marked with *. We receive a small commission on sales, nothing changes for you.

Installing Python 2 And Python 3 On The Same Device

Can I Have Python 2 And 3 Installed?

Python, like many things, is updated over time to new standards and with the latest features.

It is actually a not-for-profit organization known as Python Software Foundation, they own the copyright and manage the consistent language updates found in versions 2.1 and higher.

The most common versions of Python that are used are Python 2.x and Python 3.x. There are a few stark differences between the two.

So, something that is compatible with Python 2.x, may not run in Python 3.x, this can happen the other way around as well.

This is why it can be ideal for users of Python to have more than one version installed on their computer.

You can actually have both Python 2 and Python 3 on your Windows device or a Linux device as well.

You can craft differing environments on different IDEs to best use the versions on their own, or you could also use them in some other ways using command prompts.

Below are some ways in which you can do this.

Running Python 2 & 3 By Renaming Files

One crafty way that you can run both Python 2 and Python 3 on the same device is to simply rename the files.

It might sound silly, but it is true, and you can do it.

First of all you need to install both versions with their default Windows installers.

Then go to your default installation path which will be [C:\python2x0 and rename it from python.exe to python2.eve.

Then just edit your variables to include the directory link which should look something like this:


This link is based off of the installation of Python 2.4 and Python 3.2. Edit yours based on which versions you are installing.

Do note that it is totally possible that there may be an issue when you change the variables as they both have the same name which is python.exe, until changed.

So, if you do run into any trouble make sure that you edit the names, even if you only change 1 this will work, it is just as long as they do not both have the same name.

This means that if you renamed python3 to python3.exe, but kept python 2 the same, then when you open python you will get version 2.

Doing this enables you to use both versions of Python on the same device.

Running Python 2 & 3 By Using ‘py’ Command

However, this is not the only way to do this, you can do this by using the ‘py’ command as well.

So, to do this simply install your desired version of Python 2 and then install your desired version of Python 3.

Then open up the command prompt on your device.

To open up the version of python 2 simply type in py -2.x to open up your version of Python 3 type in py -3.x.

This version may seem simpler, but in the long run the above option is probably easier.

Although it really depends on how you work with your computer, and your own preferences, you can decide which is best for you.

Installing Both On Windows 10

Let’s say that you wanted to have both Python 2 and Python 3 on your Windows 10 run computer.

If you have some old projects that are the best compatible with Python 2 but newer projects that are best for Python 3 this is ideal, and Windows 10 is a good system for Python.

So, you need to start by downloading both versions from the download page from Python.

Install these two versions, starting with Python 2, and then select ‘install for all users’, followed by ‘install to default folder’, then click on ‘next’ to your following screen.

Now install Python 3.

Double check to click on ‘install launcher for all users’ and check to ‘add Python 3 to PATH’, and then ‘install now’.

Next you want to open your terminal window and run Python, this will start up the interpreter for Python 2.

Now this is where the ‘install for all users’ part earlier comes in handy as it will install the launcher which will allow you to choose between the versions of Python.

However, if you start without these then the Python 3 interpreter will start. Using ‘py’ you can start up whichever interpreter you want.

However, ideally you want to utilize virtualenv and craft ideal environments for your work.

Add in the -m in order to be able to run whichever modules with the sought version of Python.

To make the environments you want to use this, which is downloaded with Python 2 so try to try py -2 -m pip freeze to access this. Also run the venv included with Python 3.

Use the code py -2 -m virtualenv name-of-virtualenv and py -3 -m venv name-of-virtualenv. And… you’re done!

To Conclude

To answer your question.

Yes, you most definitely have Python 2 and 3 installed at the same time, on the same device, it just takes a little extra effort to do so, but that should be no issue, it’s not rocket science, you could just rename the folders after all!

Advertising links are marked with *. We receive a small commission on sales, nothing changes for you.