• [转]安装PIL时注册表中找不到python2.7


    如果在win7x64安装python2.7的时候选择了all user,则安装PIL的时候会显示找不到python。

    解决办法:复制下面的代码到一个.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()  
  • 相关阅读:
    DOM事件模型
    Javascript 跨域
    浏览器内核及差异
    对WEB标准的理解
    SVN权限解析规则详解
    一款成熟的前端框架——Bootstrap
    终于可以发文了
    一些感想
    Linux升级nodejs及多版本管理
    zepto 自定义build
  • 原文地址:https://www.cnblogs.com/chengjue924/p/8882961.html
Copyright © 2020-2023  润新知