Python 2 の mysql。7 では Python v2.7 が見つからないと表示されます
-
12-12-2019 - |
質問
mysqlサイトからmysql-connector-python-1.0.7-py2.7.msiをダウンロードしてインストールしようとしましたが、エラーが発生しました。
Python v2.7 が見つかりません。python.org の Microsoft Windows インストーラー (MSI) のみをサポートします。
Windows XP SP3 と MySQL esssential5.1.66 で公式 Python v 2.7.3 を使用しています。
助けが必要 ???
解決 2
この問題のために私が得る解決策は
です私はレジストリにPythonを追加することを発見しました、次のようなスクリプトはPython V 2.0以降に適用されます。 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()
.
任意の名前で保存します。 Pythonのインタプリタからそれを実行し、それはすべてです!!
他のヒント
mysql-connector-python-1.0.7-py2.7.msi
とmysql-connector-python-1.0.7-py3.2.msi
をインストールするときにWindows 7でも同様の問題を満たしました。
Python for WindowsにPythonをインストールするときに"Install only for yourself"
から"Install for all users"
に変更した後、"python 3.2 not found"
の問題が消え、mysql-connector-python-1.0.7-py3.2.msi
が正常にインストールされました。
問題は、MySQL ConnectorインストーラがHKEY_LOCAL_MACHINE
エントリのみを探すことが一般的に対応することが一般的に対応することができるということです。そうすれば、REGテーブルを直接変更するソリューションも機能します。
この問題は主に 64 ビット Windows で発生します。このリンクからPython 64ビット用のMySQLをダウンロードしてください http://www.codegood.com/archives/129 そしてダウンロード MySQL-python-1.2.3.win-amd64-py2.7.exe (1.0 MiB) これにより、Python 用の MySQL がインストールされます。
Windows 10 (64ビット):
実際、私も同様の問題に遭遇し、MySQL 用の Python 2.7 コネクタをインストールできませんでした。
この前にインストールしました Python 2.7.15
とともに Windows x86-64 MSI installer
,
これは私が持っていた間のことでした Python 3
私のマシンにインストールされています。
の Windows x86 MSI installer
うまくいきました、インストールしました オーバーライド 以前のバージョンの Python 2.7.15 をインストールしてから、コネクタをインストールしました (今回はエラー メッセージは表示されませんでした)。
x64
または他のPythonモジュールでこれを経験している場合は、このWebサイト x64 / x32
Python を内部からのみ使用しているため、この問題が発生しました SPSS. 。この問題は、次の 2 つのレジストリ キーを手動で追加することで解決しました。
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
これにより、以前のラップトップと現在のラップトップの問題が簡単に解決されました。
私の場合は、私のユーザーのためにPython 2.7.14 x 64をインストールしました。私は私のレジストリでこれを探す必要があります:
HKEY_CURRENT_USER\Software\Python
.
、それらをエクスポートするには、テキストエディタでエクスポートされた.reg
ファイルを開き、HKEY_CURRENT_USER
のすべての出現をHKEY_LOCAL_MACHINE
に置き換えてインポートします。
結果は次のとおりです。(インストールDIRを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"
.
とその後の設置はそよ風として滑らかです。ヴィオラ!
32bit Python
を使用してこの問題を解決しました