栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

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

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

适用于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解释器运行它,就这样!



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/623750.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号