Question

J'ai téléchargé MySQL-Connector-Python-1.0.7-Py2.7.msi à partir du site MySQL et j'essaie d'installer, mais il donne une erreur que

Python v2.7 introuvable.Nous prenons uniquement en charge Microsoft Windows Installer (MSI) de python.org.

J'utilise Official Python v 2.7.3 sur Windows XP SP3 avec MySQL esssential5.1.66

Besoin d'aide ???

Était-ce utile?

La solution 2

La solution que je reçois pour ce problème est

J'ai trouvé l'ajout de Python au registre, le script comme suit applicable à Python V 2.0 et supérieur: Enregistrez un interprète python

#
# 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()

Enregistrez-le avec n'importe quel nom. Exécutez-le de l'interprète Python et c'est tout !!

Autres conseils

J'ai rencontré le même problème sous Windows 7 lors de l'installation mysql-connector-python-1.0.7-py2.7.msi et mysql-connector-python-1.0.7-py3.2.msi.

Après avoir changé de "Install only for yourself" à "Install for all users" lors de l'installation de Python pour Windows, le "python 3.2 not found" le problème disparaît et mysql-connector-python-1.0.7-py3.2.msi a été installé avec succès.

Je suppose que le problème est que le programme d'installation du connecteur MySQL recherche uniquement HKEY_LOCAL_MACHINE entrées, et les éléments recherchés pourraient se trouver sous HKEY_CURRENT_USER etc.Ainsi, la solution qui modifie directement la table reg fonctionne également.

Ce problème concerne principalement les fenêtres 64 bits.téléchargez MySQL pour python 64 bits sur ce lien http://www.codegood.com/archives/129 et téléchargez MySQL-python-1.2.3.win-amd64-py2.7.exe (1,0 Mo) Cela installera MySQL pour python.

Windows 10 (64 bits) :
En effet, j'ai eu un problème similaire et je n'ai pas pu installer le connecteur python 2.7 pour MySQL.

Avant cela, j'ai installé Python 2.7.15 avec le Windows x86-64 MSI installer,
c'était pendant que j'avais Python 3 installé sur ma machine.

Le Windows x86 MSI installer j'ai fait l'affaire, je l'ai installé sur passer outre la version précédente de Python 2.7.15, puis installé le connecteur (cette fois il n'a donné aucun message d'erreur).

Ensuite, revérifiez l'état dans le programme d'installation MySQL et voilà :
Python27 connector recognized

Si vous rencontrez toujours cela avec x64 ou d'autres modules Python, je recommanderais ce site Web extensions de python pour x64 / x32

J'ai eu ce problème parce que j'utilise Python uniquement de l'intérieur SPSS.J'ai résolu ce problème en ajoutant manuellement deux clés de registre :

HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath

mis à

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

et

HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\PythonPath

mis à

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

Cela a facilement résolu le problème sur mes ordinateurs portables précédents et actuels.

Vous devez vous assurer que vous téléchargez la version avec le «bit» correct (32/64 bit), correspondant à la "bitness" de votre installation Python!

J'ai couru dans le même problème (avec Python 3.7.2, cependant).

J'avais Python 3.7.2 32 bit déjà installé, mais a correctement téléchargé la version 64 bits du connecteur MySQL pour Python 3.7.

Lorsque j'ai essayé d'installer le connecteur, j'ai eu le même message d'erreur:

 message d'erreur

Solution: Je viens de télécharger la version 32 bits à la place et tout a fonctionné (installation du connecteur et se connectant en réalité à la base de données)

Dans mon cas, j'ai installé python 2.7.14 x64 uniquement pour mon utilisateur.Je dois chercher ceci dans mon registre :

HKEY_CURRENT_USER\Software\Python

, exportez-les, ouvrez le fichier exporté .reg fichier avec un éditeur de texte, remplacez toutes les occurrences de HKEY_CURRENT_USER avec HKEY_LOCAL_MACHINE, et importez-le.

Le résultat est:(n'oubliez pas de remplacer le répertoire d'installation par le vôtre)

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"

Et l’installation se déroule ensuite en douceur.Alto!

J'ai résolu ce problème en utilisant 32bit Python

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top