Actually it depends on what OS you are talking about. I assume you are talking about a Mac since you mentioned a Macbook.
Macs comes with 2.5 and 2.6 installed, as far as I know. At least I have both versions, and I only installed 2.7 manually.
You can check which version of python is the current "system" python by doing the following in a terminal:
// check the version of system python python
On operating systems such as * nix, such as Macs, applications are not actually installed, as on Windows (details). Instead, application files are located in different parts of the file system. For example, Python is placed in the following directory (default) when installing 2.7:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
Since this directory is not located on the PATH system, this version of python will not be used when you simply call python from the command line. The system will look for all the folders in the PATH environment variable for the executable called python. Usually he will find it in /usr/bin/ or something similar.
To create a new version of Python for the python "system", you have several options:
- Modify your .bash_profile and add the path to the new python to the PATH environment variable.
- symlink new version of python to a directory already on your PATH, for example / usr / bin /
Remember that Mac python installers can modify your .bash_profile (in your home directory) so that the new version is a standard version of the system. Here is what my bash_profile shows:
# Setting PATH for Python 2.7
You can happily run multiple versions of python on the same system. The private version is usually the default, and that any python executable is located on the PATH in the first place.
If you want to use a different version at any given time, you can:
/path/to/python/2.4/python some_script.py /path/to/python/2.7/python some_script.py /path/to/python/3.2/python some_script.py
This will execute some_script.py script in three different versions of python. Of course, you must make sure that / path / to / python is correct.
So, you should remember which version of python you are going to use, I hope this helps you understand how applications are installed and which version of the application starts by default when you do not provide a path.