Python2 command not found

Viewed 4308

So I tried cloning this git just like the tutorial did and the program is made on python2 and as the tutorial said I was gonna run the command python2 main.py but then it doesn't work, what can I do to make it work? please help me, thank you.

OS: Windows 10 Python Version: Python 3.8 Command ran: python2 main.py Ran on: Git Bash more info: I also can't run the command:python3 on Bash so I use winpty python.exe instead and I don't have python 2 installed, only python 3.8 would that be the cause?

please help me out thank you :)

2 Answers

Running python 2 scripts using python 3 may give errors.

I don't have python 2 installed

Download Python 2 here

You can have both python 2 and python 3 installed on windows at same time. But make sure your environment variables are properly configured for both.

After installing python 2, Goto installation directory (default location is C:/python27/) and make a copy of python.exe and rename it as python2.exe. After, add python2 directory to PATH environment variable then you can run python 2 scripts like python2 script.py on your commandline.

How to change environment variable in Windows 10

Thanks!

you have to find out where you have installed python2, if there is any.

which python
which python2

In all likelihood, it is just simply python

python --version

if you get 2.x, you can use python command to run the python code.

Related