zoukankan      html  css  js  c++  java
  • Python安装coverage.py

    coverage.py是一个用来统计python程序代码覆盖率的工具。它使用起来非常简单,并且支持最终生成界面友好的html报告。在最新版本中,还提供了分支覆盖的功能。

    官方网站:

    http://nedbatchelder.com/code/coverage/ 

    出现错误:

    解决办法:

    建立一个文件 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()  

    启动命令切到register.py文件目录下执行:

    重新安装,错误解决,安装成功。

  • 相关阅读:
    Nginx 相关配置文件修改
    LNMP平台构建实验 +bbs社区搭建
    CSGO项目
    创世战车项目
    IGXE搬砖项目
    11_samba服务器的搭建
    26_django内置static标签
    06_git添加远程仓库并向远程仓库中推送代码
    23_添加apps到项目的搜索路径
    23_django日志器的配置和其使用方法
  • 原文地址:https://www.cnblogs.com/chamie/p/5259723.html
Copyright © 2011-2022 走看看