Comment #33 on issue 1235 by daniel.g...@gmail.com: Problem installing in Windows
http://code.google.com/p/sympy/issues/detail?id=1235

Now i will describe what is the problem and how to solve it:
If we install "python-2.7.2.amd64.msi" or the newer version of python when we try to install "SymPy" we get an error message: "No Python information found in the registry".
That's because "python-2.7.2.amd64.msi" installer put his regystry file in:
        [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\InstallPath],
but when we build with "dbilt" and start the builded file(if it's 32-bit), it search in: [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.6\InstallPath] and
        [HKEY_CURRENT_USER\Software\Python\PythonCore]
You can see the difference and that's why SymPy didn't find Python in Regystry
There a few ways to deal with the problem:
1.Install SymPy from source with:
        python setup.py install

2.To have "sympy-0.7.1.win-amd64.exe" installer(i have made one).It can be made by
cross-compiling, but ONLY UNDER WINDOWS!

3.Use my script and install with "sympy-0.7.1.win32.exe" from:
http://code.google.com/p/sympy/downloads/list

What do my script is simply copy information of:
        [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\InstallPath]
in      [HKEY_CURRENT_USER\Software\Python\PythonCore]
so the "sympy-0.7.1.win32.exe" binary will found it in regystry.It can also be made to copy to [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.6\InstallPath]
but i must start the script with Administrator privileges in Windows...

so here's the script:

import sys

from _winreg import *


version = sys.version[:3]
installpath = sys.prefix

regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)
installkey = "InstallPath"
pythonkey = "PythonPath"
pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % (
    installpath, installpath, installpath
)

def RegisterPy():
    try:
        reg = OpenKey(HKEY_CURRENT_USER, regpath)
    except EnvironmentError:
        try:
            reg = CreateKey(HKEY_CURRENT_USER, regpath)
            SetValue(reg, installkey, REG_SZ, installpath)
            SetValue(reg, pythonkey, REG_SZ, pythonpath)
            CloseKey(reg)
        except:
            print "*** Unable to register!"
            return
        print "--- Python", version, "is now registered!"
        return
    if (QueryValue(reg, installkey) == installpath and
        QueryValue(reg, pythonkey) == pythonpath):
        CloseKey(reg)
        print "=== Python", version, "is already registered!"
        return
    CloseKey(reg)
    print "*** Unable to register!"
    print "*** You probably have another Python installation!"

if __name__ == "__main__":
    RegisterPy()


Attachments:
        sympy-0.7.1.win-amd64.exe  1.9 MB
        regystry.py  1.1 KB

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to