MySQL per Python 2. 7 dice Python V2.7 non trovato
-
12-12-2019 - |
Domanda
Ho scaricato MySQL-Connector-Python-1.0.7-PY2.7.msi dal sito di MySQL e prova ad installare ma dà errore
Python v2.7 non trovato.Supportiamo solo Microsoft Windows Installer (MSI) da Python.org.
Sto usando Python V 2.7.3 ufficiale su Windows XP SP3 con MySQL Essential5.1.66
Hai bisogno di aiuto ???
Soluzione 2
La soluzione che ottengo per questo problema è
Ho trovato l'aggiunta di Python al registro, lo script come segue applicabile per Python V 2.0 e sopra: Registrati 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()
.
Salvalo con qualsiasi nome. Eseguilo da Python Interpreter e questo è tutto !!
Altri suggerimenti
Ho incontrato il problema simile sotto Windows 7 quando si installa mysql-connector-python-1.0.7-py2.7.msi
e mysql-connector-python-1.0.7-py3.2.msi
.
Dopo aver modificato da "Install only for yourself"
a "Install for all users"
Quando si installa Python per Windows, il problema "python 3.2 not found"
scompare e mysql-connector-python-1.0.7-py3.2.msi
è stato installato correttamente.
Immagino che il problema sia che il connettore MySQL installer cerchi solo le voci HKEY_LOCAL_MACHINE
, e le cose che cerca potrebbero essere sotto HKEY_CURRENT_USER
ecc. Quindi la soluzione che cambia direttamente la tabella del registro funziona anche.
Questo problema viene fornito principalmente con finestre a 64 bit. 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.
Prima di questo ho installato Python 2.7.15
con Windows x86-64 MSI installer
,
Questo era mentre avevo generatodicetagcode installato sulla mia macchina.
the Python 3
ha fatto il trucco , L'ho installato su override la versione precedente di Python 2.7.15, quindi installato il connettore (questa volta non ha fornito messaggi di errore).
Quindi ricontrollare lo stato nel programma di installazione di MySQL e Voilà:
Se stai ancora vivendo con x64
o altri moduli Python, consiglierei questo sito Web Estensioni Python per X64 / X32
Ho avuto questo problema perché uso Python solo da SPSS .Ho risolto questo problema aggiungendo manualmente due chiavi di registro:
HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath
C:\Program Files\IBM\SPSS\Statistics\24\Python
HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\PythonPath
C:\Program Files\IBM\SPSS\Statistics\24\Python\Lib
Questo ha risolto facilmente il problema sui miei computer portatili precedenti e attuali.
È necessario assicurarsi di scaricare la versione con la "bittà" corretta (35/64 bit), corrispondente alla "bittà" della tua installazione di Python!
Ho corso nello stesso problema (con Python 3.7.2, però).
Avevo Python 3.7.2 32 bit già installato, ma scaricato accidentalmente il 64 bit del connettore MySQL per Python 3.7.
Quando ho provato ad installare il connettore, ho ottenuto lo stesso messaggio di errore:
Soluzione: ho appena scaricato invece la versione a 32 bit e tutto funzionava (installando il connettore e effettivamente connesso al database)
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
.
, esportali, aprire il file .reg
esportato con un editor di testo, sostituire tutta l'occorrenza di HKEY_CURRENT_USER
con HKEY_LOCAL_MACHINE
e importarlo.
Il risultato è: (ricorda di cambiare l'installazione dir sul 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 una brezza.Viola!
Ho risolto questo problema usando Python a 32 bit