12

MySQL サイトから mysql-connector-python-1.0.7-py2.7.msi をダウンロードしてインストールしようとしましたが、次のエラーが発生します。

Python v2.7 が見つかりません。python.org の Microsoft Windows Installer (MSI) のみをサポートしています。

MySQL esssential5.1.66を搭載したWindows XP SP3で公式のPython v 2.7.3を使用しています

助けが必要 ???

4

8 に答える 8

10

mysql-connector-python-1.0.7-py2.7.msiとをインストールすると、Windows7でも同様の問題が発生しましたmysql-connector-python-1.0.7-py3.2.msi

Python for Windowsのインストール時にから"Install only for yourself"に変更すると、問題は解消され、正常にインストールされました。"Install for all users""python 3.2 not found"mysql-connector-python-1.0.7-py3.2.msi

問題は、mysqlコネクタインストーラがHKEY_LOCAL_MACHINEエントリのみを検索し、検索するものが下にある可能性があることだと思いますHKEY_CURRENT_USER。したがって、regテーブルを直接変更するソリューションも機能します。

于 2012-12-16T07:41:06.750 に答える
8

この問題の解決策は

レジストリに 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インタープリターから実行すると、それだけです!!

于 2012-10-06T06:33:23.423 に答える
4

x64または他のPythonモジュールでこれがまだ発生している場合は、このWebサイトをお勧めしますx64/x32用のPython拡張機能

于 2013-01-24T22:28:30.870 に答える
2

SPSS内からのみ Python を使用しているため、この問題が発生しました。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

これにより、以前のラップトップと現在のラップトップの問題が簡単に修正されました。

于 2016-08-09T08:12:22.670 に答える