适用于python 2的mysql。7说未找到Python v2.7

适用于python 2的mysql。7说未找到Python v2.7,第1张

适用于python 2的mysql。7说未找到Python v2.7

我为这个问题得到的解决方案是

我发现将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.htmimport sysfrom _winreg import *# tweak as necessaryversion = sys.version[:3]installpath = sys.prefixregpath = "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解释器运行它,就这样!



欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5629790.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-15

发表评论

登录后才能评论

评论列表(0条)

保存