Search code examples
pythonmysqlpython-2.7mysql-connector-python

mysql for python 2. 7 says Python v2.7 not found


I have downloaded mysql-connector-python-1.0.7-py2.7.msi from MySQL site and try to install but it gives error that

Python v2.7 not found. We only support Microsoft Windows Installer(MSI) from python.org.

I am using Official Python v 2.7.3 on windows XP SP3 with MySQL esssential5.1.66

Need Help ???


Solution

  • The Solution I get for this problem is

    I have found Adding Python to Registry, the script as follows applicable for python v 2.0 and above: Register a Python Interpreter

    #
    # script to register Python 2.0 or later for use with win32all 
    # and other extensions that require Python registry settings
    #
    # written by Joakim Low for Secret Labs AB / PythonWare
    #
    # source:
    # http://www.pythonware.com/products/works/articles/regpy20.htm
    
    import sys
    from _winreg import *
    
    # tweak as necessary
    
    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_LOCAL_MACHINE, regpath)
        except EnvironmentError:
            try:
                reg = CreateKey(HKEY_LOCAL_MACHINE, 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()
    

    Save it with any name. Run it from python interpreter and Thats ALL!!