mysql for python 2. 7 says Python v2.7 not found
Asked Answered
A

8

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

Antipodes answered 3/10, 2012 at 4:57 Comment(6)
Just download mysql-connector-python-1.0.7-py2.7 and install over mysql 5.1.66 essentialAntipodes
So, you didn't install Python then? Download the python for windows installer, run it first and then try installing the MySQL drivers.Klatt
And I also set C:\Python27 to Path variable and Sorry, I forget to mention but I already installed python 2.7.3Antipodes
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.Klatt
I installed from python.org . All other python frameworks are working and python is also working good.Only this problem persists.Antipodes
Download this installer and try it again.Klatt
A
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!!

Antipodes answered 6/10, 2012 at 6:33 Comment(0)
L
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.

Lesalesak answered 16/12, 2012 at 7:41 Comment(2)
Still relevant for connector v2.0.1. Reinstalling Python "For all users" fixed the problem.Gey
This works for me as well ("install for all users") on windows7 using python 3.4.Whitecollar
A
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!!

Antipodes answered 6/10, 2012 at 6:33 Comment(0)
P
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

Pfennig answered 30/9, 2015 at 19:7 Comment(1)
This answer provides a good choice to select the working version of mysql-python 2.7 in X64.Choong
Y
4

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

Yoon answered 24/1, 2013 at 22:28 Comment(0)
B
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.

Blackboard answered 9/8, 2016 at 8:12 Comment(1)
This inspired me and leads to my solution below. Thanks.Nahuatlan
S
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)

Shakti answered 21/1, 2019 at 15:3 Comment(0)
N
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!

Nahuatlan answered 16/10, 2017 at 13:47 Comment(0)
S
0

I solved this problem by using 32bit python

Snowman answered 27/9, 2013 at 12:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.