zoukankan      html  css  js  c++  java
  • python pyHook安装

    Hook安装

    哇 这东西可真费劲  主要有pyhook和pyhook3 两种 每个都要根据系统版本和python版本 分成各种小版本

    具体安装

    一.可以在cmd 中输入 pip install pyhook 来尝试自动在线安装 一般都不行

    二.可以去https://www.lfd.uci.edu/~gohlke/pythonlibs/ 中寻找自己喜欢的版本 

    然后下载

    在cmd中输入  pip install 将刚下载的*.whl文件拖入cmd 回车安装

    三.去https://sourceforge.net 里面搜 或许有自动安装包 不过python有注册表问题 安装中会报错 “没有找到该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()

    四.如果安装了多个版本python 在cmd时只会显示一种,这样pip安装不能指向所需要的版本,就需要更改环境变量Path,删掉不需要的版本即可,同时一定记得备份该数据。如果在更改完使用一些基本cmd命令无效,如ipconfig 需要在环境变量Path头部添加《c:windowssystem32;》 去掉书名号 

    ----

    最重要的是由于python3.7的hook 不能抓有中文标题的窗口 被我放弃了 

    ----

    python 安装了太多版本 charm里面都混乱了  在执行测试的时候一直报“ImportError: DLL load failed: 找不到指定的模块”  我一直以为安装的版本 不对或者没安装到位

    最后发现是charm里面并没有选对 合适python  ~.~

  • 相关阅读:
    锋利的jQuery(第二版)源码下载地址
    sql(SqlServer)编程基本语法
    struts2 中请求转发与请求重定向方法
    struts2的DevMode(开发模式)模式
    ML—朴素贝叶斯
    python 全排列
    简单读懂人工智能:机器学习与深度学习是什么关系
    Postfix接收邮件后转向运行特定的脚本
    Android的View和ViewGroup分析
    简明 状态模式(5.8)
  • 原文地址:https://www.cnblogs.com/moshuixiong/p/11334446.html
Copyright © 2011-2022 走看看