安装 MySQLdb 出现 Python version 2.7 required, which was not found in the registry
来源:互联网 发布:网络电视找不到电视猫 编辑:程序博客网 时间:2024/05/03 12:22
最近在学习python,然后在学到python操作数据库的时候出了些问题:安装 MySQLdb 出现 Python version 2.7 required, which was not found in the registry ,查证了一下 原来是需要python注册一下才可以,建立一个文件 register.py 内容如下. 然后执行该脚本.
import 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_CURRENT_USER, regpath) except EnvironmentError as e: try: reg = CreateKey(HKEY_CURRENT_USER, 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()
MySQLdb的下载地址:http://sourceforge.net/projects/mysql-python/
1 0
- 安装 MySQLdb 出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- windows安装python mysqldb时报错python version 2.7 required,which was not found in the registry
- 安装Python-Matplotlib时出现的问题--Python version 2.7 required, which was not found in the registry
- 安装Python-Matplotlib时出现的问题--Python version 2.7 required, which was not found in the registry
- 解决安装MySQL-python出现的:Python version 2.7 required, which was not found in the registry
- [解决]在安装Python PIL 时出现错误: Python version 2.7 required, which was not found in the registry
- 中文分词之左右完整性及稳定性
- 测试管理-测试任务安排
- 散列表的插入和删除
- 使用Chrome来调试你的Android App
- 《IOS多线程基础》
- 安装 MySQLdb 出现 Python version 2.7 required, which was not found in the registry
- Node.js入门第二讲
- 语言模型srilm(二) prune剪枝
- [Android]代码实现ColorStateList及StateListDrawable
- Vmvare 安装mac系统遇到几个小问题
- 一个简单的嗅探器
- 好雨云使用OKRs做绩效管理
- 十四周项目2 二叉树排序树中的查找路径
- Math类与Random类使用(Java)