简体   繁体   中英

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 ?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM