2012-10-03 13 views
12

Ho scaricato mysql-connector-python-1.0.7-py2.7.msi da MySQL sito e provare a installare ma dà errore chemysql per Python 2. 7 dice Python v2.7 non trovato

Python v2.7 non trovato. Supportiamo solo Microsoft Windows Installer (MSI) da python.org.

Sto usando Ufficiale Python v 2.7.3 su Windows XP SP3 con MySQL esssential5.1.66

necessario un ulteriore supporto ???

+0

Come hai installato Python? –

+0

Basta scaricare mysql-connector-python-1.0.7-py2.7 e installare su mysql 5.1.66 essential –

+0

Quindi, non hai installato Python? Scarica il [python per Windows Installer] (http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi), eseguilo prima e poi prova a installare i driver MySQL. –

risposta

8

La soluzione che ho per questo problema è

ho trovato Aggiunta di Python per Registro di sistema, lo script come segue applicabile per Python v 2.0 e superiori: Registra un interprete 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() 

Salva esso con qualsiasi nome Eseguilo dall'interprete python e questo è TUTTO !!

10

Ho incontrato il problema simile in Windows 7 durante l'installazione di mysql-connector-python-1.0.7-py2.7.msi e mysql-connector-python-1.0.7-py3.2.msi.

Dopo aver cambiato "Install only for yourself"-"Install for all users" durante l'installazione di Python per le finestre, il problema scompare e "python 3.2 not found"mysql-connector-python-1.0.7-py3.2.msi stato installato con successo.

Credo che il problema è che il programma di installazione del connettore mysql cerca solo le voci HKEY_LOCAL_MACHINE e le cose che cerca potrebbero essere inferiori a HKEY_CURRENT_USER ecc. Quindi funziona anche la soluzione che modifica direttamente la tabella di reg.

+0

Ancora rilevante per il connettore v2.0.1. Reinstallando Python '" Per tutti gli utenti "' risolto il problema. – primo

+1

Questo funziona anche per me ("installa per tutti gli utenti") su windows7 usando python 3.4. – user3375672

0

Ho risolto questo problema utilizzando 32bit python

5

Questo problema deriva principalmente con 64 bit di Windows. scarica MySQL per python 64 bit su questo link http://www.codegood.com/archives/129 e scarica MySQL-python-1.2.3.win-amd64-py2.7.exe (1.0 MiB) Questo installerà MySQL per python.

+0

Questa risposta fornisce una buona scelta per selezionare la versione di lavoro di mysql-python 2.7 in X64. – zionpi

1

ho avuto questo problema, perché io uso Python solo dall'interno SPSS. Ho risolto il problema aggiungendo manualmente due chiavi di registro:

HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath

impostato su

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

e

HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\PythonPath

insieme a

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

Ciò ha risolto facilmente il problema sui miei laptop precedenti e attuali.

+0

Questo mi ha ispirato e porta alla mia soluzione qui sotto. Grazie. – FaithReaper

0

Nel mio caso, ho installato python 2.7.14 x64 solo per il mio utente. Devo cercare questo nel mio registro:

HKEY_CURRENT_USER\Software\Python 

, esportarli, aprire il file esportato .reg con un editor di testo, sostituire tutte le occorrenze di HKEY_CURRENT_USER con HKEY_LOCAL_MACHINE, e importarlo.

Il risultato è: (ricordarsi di cambiare l'installazione dir al tuo)

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" 

E l'installazione in seguito è liscia come un gioco da ragazzi. Viola!

Problemi correlati