12

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 ???

unutbu
  • 842,883
  • 184
  • 1,785
  • 1,677
Mayur Patil
  • 952
  • 1
  • 10
  • 18
  • Just download mysql-connector-python-1.0.7-py2.7 and install over mysql 5.1.66 essential – Mayur Patil Oct 03 '12 at 05:07
  • So, you didn't install Python then? Download the [python for windows installer](http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi), run it first and then try installing the MySQL drivers. – Burhan Khalid Oct 03 '12 at 05:26
  • And I also set C:\Python27 to Path variable and Sorry, I forget to mention but I already installed python 2.7.3 – Mayur Patil Oct 03 '12 at 05:33
  • 1
    *How* did you install Python. If you did not use the installer from python.org; then the correct registry entries would not have been written - which is why the MySQL installer is complaining. – Burhan Khalid Oct 03 '12 at 05:41
  • I installed from python.org . All other python frameworks are working and python is also working good.Only this problem persists. – Mayur Patil Oct 03 '12 at 11:44
  • Download [this installer](http://www.lfd.uci.edu/~gohlke/pythonlibs/b76p4jz8/MySQL-python-1.2.3.win32-py2.7.exe) and try it again. – Burhan Khalid Oct 03 '12 at 11:51

8 Answers8

10

I met the similar problem under Windows 7 when installing mysql-connector-python-1.0.7-py2.7.msi and mysql-connector-python-1.0.7-py3.2.msi.

After changing from "Install only for yourself" to "Install for all users" when installing Python for windows, the "python 3.2 not found" problem disappear and mysql-connector-python-1.0.7-py3.2.msi was successfully installed.

I guess the problem is that mysql connector installer only looks for HKEY_LOCAL_MACHINE entries, and the things it looks for might be under HKEY_CURRENT_USER etc. So the solution that change the reg table directly also works.

NorthCat
  • 9,643
  • 16
  • 47
  • 50
Moony Chou
  • 497
  • 5
  • 10
8

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!!

Mayur Patil
  • 952
  • 1
  • 10
  • 18
7

This problem mainly comes with 64 bit windows. download MySQL for python 64 bit on this link http://www.codegood.com/archives/129 and download MySQL-python-1.2.3.win-amd64-py2.7.exe (1.0 MiB) This will install MySQL for python.

Windows 10 (64bit):
Indeed, I've had a similar issue and couldn't install the python 2.7 connector for MySQL.

Prior to this I've installed Python 2.7.15 with the Windows x86-64 MSI installer,
this was while I had Python 3 installed on my machine.

The Windows x86 MSI installer did the trick, I've installed it to override the previous version of Python 2.7.15, then installed the connector (this time it gave no error messages).

Then rechecked the status in the MySQL installer and voilà:
Python27 connector recognized

GrizzlyMcBear
  • 304
  • 1
  • 15
dinesh.kumar
  • 167
  • 1
  • 10
  • This answer provides a good choice to select the working version of mysql-python 2.7 in X64. – zionpi Mar 22 '16 at 08:35
4

If you're still experiencing this with x64 or other python modules, I'd recommend this website Python Extensions for x64/x32

classicjonesynz
  • 4,012
  • 5
  • 38
  • 78
2

I had this problem because I use Python only from within SPSS. I resolved this problem by manually adding two registry keys:

HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath

set to

C:\Program Files\IBM\SPSS\Statistics\24\Python

and

HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\PythonPath

set to

C:\Program Files\IBM\SPSS\Statistics\24\Python\Lib

This easily fixed the issue on my previous as well as current laptops.

RubenGeert
  • 2,902
  • 6
  • 32
  • 50
2

You need to make sure that you download the version with the correct "bitness" (32/64 bit), matching the "bitness" of your Python installation!

I ran into the same problem (with Python 3.7.2, though).

I had Python 3.7.2 32 bit already installed, but accidentally downloaded the 64 bit version of the MySQL Connector for Python 3.7.

When I tried to install the connector, I got the same error message:

error message

Solution: I just downloaded the 32 bit version instead, and everything worked (installing the connector and actually connecting to the database)

Christian Specht
  • 35,843
  • 15
  • 128
  • 182
1

In my case, I installed python 2.7.14 x64 only for my user. I have to look for this in my registry:

HKEY_CURRENT_USER\Software\Python

, export them, open the exported .reg file with a text editor, replace all occurrence of HKEY_CURRENT_USER with HKEY_LOCAL_MACHINE, and import it.

The result is: (remember to change the install dir to yours)

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Python]

[HKEY_LOCAL_MACHINE\Software\Python\PythonCore]

[HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.7]

[HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.7\Help]

[HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.7\Help\Main Python Documentation]
@="D:\\Desarrollo\\entornos\\python27_x64\\Doc\\python2714.chm"

[HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.7\InstallPath]
@="D:\\Desarrollo\\entornos\\python27_x64\\"

[HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.7\InstallPath\InstallGroup]
@="Python 2.7"

[HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.7\Modules]

[HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.7\PythonPath]
@="D:\\Desarrollo\\entornos\\python27_x64\\Lib;D:\\Desarrollo\\entornos\\python27_x64\\DLLs;D:\\Desarrollo\\entornos\\python27_x64\\Lib\\lib-tk"

And the installation afterwards is smooth as a breeze. Viola!

WesternGun
  • 11,303
  • 6
  • 88
  • 157
0

I solved this problem by using 32bit python

Sar009
  • 2,166
  • 5
  • 29
  • 48