发布于 2014-12-06 17:01:23 | 1289 次阅读 | 评论: 1 | 来源: PHPERZ

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

Python编程语言

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


本文为大家讲解的是Python安装第三方库报错: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.

解决方法:

是执行下面的脚本register.py:

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安装第三方库报错:Python version 2.7 required, which was not found in the registry.解决方法
MySQL-python-1.2.4b4.win32-py2.7安装报错: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首次安装后运行报错(0xc000007b)的解决方法
python安装错误:UnicodeDecodeError: 'ascii' codec can't decode byte解决方法
python程序报错 IOError: decoder zip not available解决方法
ubuntu上跑python连接pg,报错 ImportError: No module named psycopg2解决方法
Python处理JSON时的值报错及编码报错的两则解决实录
完美解决python遍历删除字典里值为空的元素报错问题
python中异常报错处理方法汇总
python错误:AttributeError: 'module' object has no attribute 'setdefaultencoding'解决方法
最新网友评论  共有(1)条评论 发布评论 返回顶部
mmsbhb 发布于2015-08-21 16:29:31
学习了啊!
支持(0)  反对(0)  回复

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