2

How do I add python2 to PATH? python works fine, however I am invoking a make file that points to many files with calls to python2.

C:\Users\andcy\$DETECTRON>python2
'python2' is not recognized as an internal or external command,
operable program or batch file.

Unfortunately, my search for related points brought me answers that did not apply. For example, the following SO post only shows how to add python to the path, not python2.

Add "python2" path to command line on Windows 7

asked Jul 9, 2018 at 20:00
1
  • Have you tried python or py as a command line argument? Commented Jul 9, 2018 at 20:21

1 Answer 1

7

If your make endpoints insist on python2, just DOSKEY a python2 alias before calling your make, e.g.:

DOSKEY python2=python $*

If you're looking for something more permanent just create a python2.cmd file in the same directory as your Python binary (i.e. python.exe) to execute it on your behalf:

@echo off
"%~dp0\python.exe" %*

Or, as a quick and dirty solution, if you don't care about the python.exe itself just rename it to python2.exe.

answered Jul 9, 2018 at 20:27
Sign up to request clarification or add additional context in comments.

1 Comment

Creating python2.cmd works, however, I would not recommend renaming python.exe to python2.exe as this can cause errors when trying to access the standard python 2 installation path

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.