Reputation: 3742
I need to use both python 2 and python 3.
The only way to change the default python used upon opening a .py file to is change the PATH environment variable. The steps are troublesome.
Can I have some windows batch script which modify the PATH variable for me?
Thanks.
Upvotes: 1
Views: 203
Reputation: 1
I got a easy way to switch. Install both python27 and python33 in C:> . Then there will be two folders python27 and python33. Set the system path to python27 by default. If you want to use python33, change python27 folder name to something like python27_274 and change python33 folder name to python27:)
Upvotes: 0
Reputation: 18850
Yes, modify the PATH through a batch script:
This will start Python2:
C:\> set PATH=C:\Python27\;%PATH%
C:\> python.exe
This will start Python3:
C:\> set PATH=C:\Python32\;%PATH%
C:\> python.exe
(Notice that the changed PATH is only valid for your current command shell session)
Upvotes: 2
Reputation: 16403
You can use regedit to export the path key from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
.
This way you create two reg files: one with python2 in the path and one with python3. Double clicking the respective file will change the path accordingly.
Upvotes: 0