Reputation: 115
I've installed Python 2.7 and python 3.4 on my system. Earlier i was using 3.4 but now require 2.7 as well (for a course I'm taking, which requires some files which are not there for 3.4). When I type python in cmd it by default initializes 3.4. Is there some way to change it to 2.7 by default?
Thanks
UPDATE: I was able to invoke it using 'py'. Here's the link if anyone else has a confusion. https://docs.python.org/3/using/windows.html?highlight=shebang#python-launcher-for-windows (from some other answer)
Upvotes: 0
Views: 53
Reputation: 31895
Update: If your system environment is Windows:
1) call py -2.7
or py -3
based on the version you want.
2) change your PATH system environment variable , makes sure it refers to the version you want.
You can do it in serveral ways on Linux environment:
1) call a specific Python binary you can call the explicit full path (e. g. /usr/local/bin/python). This will call the same executable regardless of the value of the $PATH variable.
2) configure your accounts so that both have the same binary first in the $PATH variable.
3) call python2 and python3; many installations symlink these to the corresponding binaries.
$ python2
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Upvotes: 1