发布于 2014-12-06 17:20:39 | 769 次阅读 | 评论: 1 | 来源: PHPERZ

这里有新鲜出炉的Python教程,程序狗速度看过来!

Python编程语言

Python 是一种面向对象、解释型计算机程序设计语言,由Guido van Rossum于1989年底发明,第一个公开发行版发行于1991年。Python语法简洁而清晰,具有丰富和强大的类库。它常被昵称为胶水语言,它能够把用其他语言制作的各种模块(尤其是C/C++)很轻松地联结在一起。


本文为大家讲解的是MySQL-python-1.2.4b4.win32-py2.7安装报错:python version 2.7 required,which was not found in the registry.解决方法,感兴趣的同学参考下。

问题描述:

windows7 64 下安装 MySQL-python-1.2.4b4.win32-py2.7.exe报错:

python version 2.7 required,which was not found in the registry.

如下图:

安装时提示需要python2.7,但是此时python2.7已经添加到环境变量中.

解决方法:

在D盘新建register.py的文件,内容如下:

#   
# script to register Python 2.0 or later for use with win32all   
# and other extensions that require Python registry settings   
#   
# written by Joakim Loew for Secret Labs AB / PythonWare   
#   
# source:   
# http://www.pythonware.com/products/works/articles/regpy20.htm   
#   
# modified by Valentine Gogichashvili as described in http://www.mail-archive.com/distutils-sig@python.org/msg10512.html   
   
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_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()  

然后运行这个python文件,效果如下:

然后在重新安装就没有问题了。



相关阅读 :
MySQL-python-1.2.4b4.win32-py2.7安装报错:python version 2.7 required,which was not found in the registry.解决方法
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错误的解决方法
Python安装Imaging报错:The _imaging C module is not installed解决方法
Python 'takes exactly 1 argument (2 given)' Python error解决方法
Python解析json之ValueError: Expecting property name enclosed in double quotes: line 1 column 2(char 1)
python2.7 查询mysql中文乱码问题解决方法
python出现Non-ASCII character '\xe7' in file ex6.py on line 1, but no encoding declare错误解决方法
python下连接mysql的错误 错误码 【10061】 解决方法
python错误:AttributeError: 'module' object has no attribute 'setdefaultencoding'解决方法
Python提示[Errno 32]Broken pipe导致线程crash错误解决方法
python安装错误:UnicodeDecodeError: 'ascii' codec can't decode byte解决方法
最新网友评论  共有(1)条评论 发布评论 返回顶部
sfli 发布于2015-05-23 10:46:07
感觉很厉害的样子
支持(0)  反对(0)  回复

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务