Upendra Kumar added the comment:

2. Detecting different versions of Python installed :


For Windows :

It is explained in PEP 514 by Steve Dower. 

Windows has registry keys which can be accessed by winreg or _winreg module.

Priority of registry keys :
HKEY_CURRENT_USER > HKEY_LOCAL_MACHINE

On 64 bit Windows there is another registry key for 32 bit programs,
HKEY_LOCAL_MACHINE\Software\Wow6432Node

Therefore using registry keys we can know about Python packages installed by 
enumerating on :

1. HKEY_CURRENT_USER\Software\Python\<Company>\<Tag>\<InstallPath>
2. HKEY_LOCAL_MACHINE\Software\Python\<Company>\<Tag>\<InstallPath>
3. HKEY_LOCAL_MACHINE\Wow6432Node\Python\<Company>\<Tag>\<InstallPath>

<Tag> will tell the version number of Python, and in <InstallPath> key there 
are two more subkeys which will tell the location of Python executable :

1. <Executable Path>
2. <WindowedExecutablePath>




For Linux :

We can find Python installations in /usr/bin/pythonXYZ




For MAC OS :

It can be searched for in 

/Library/Frameworks/
/System/Library/Frameworks

If Python was installed by Homebrew :

Then the location can be in 
/usr/local

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27051>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to