superzamp
superzamp

Reputation: 511

Add python27 to windows path while using python 3.3

I use python 3.3.2 on windows everyday, so i added C:\Python33 to my PATH in order to be able to call "python foo.py" from console and get python 3.3.2 to execute it.

But sometimes, i also need to use python 2.7. How could i add a "python27" entry to my path, in order to call "python27 bar.py" and get python 2.7 to execute it ?

Upvotes: 0

Views: 667

Answers (2)

jfs
jfs

Reputation: 414795

Run it using pylauncher:

C:\> py -2.7 bar.py

Or add at the top of bar.py:

#! python2.7

then:

C:\> py bar.py

will use Python 2.7 version.

If pylauncher is configured to handle Python scripts; you could just call:

C:\> bar.py

Or

C:\> bar

if .py is in PATHEXT

Upvotes: 2

Chris Lawlor
Chris Lawlor

Reputation: 48972

  1. Move C:\Python27\python.exe to C:\Python27\python27.exe
  2. Add C:\Python27 to your PATH.

Upvotes: 0

Related Questions