【问题标题】:ImportError: cannot import name 'cpyHook' from partially initialized module 'pyWinhook'ImportError: cannot import name \'cpyHook\' from partially initialized module \'pyWinhook\'
【发布时间】:2022-12-02 11:09:19
【问题描述】:

This has been plaguing me for a while now, and I'm not sure what to do about it. I've tried modifying theinit.py pyWinhook script's imports, but to no avail. Here's the whole error:

Traceback (most recent call last):
  File "d:\myuser\Documents\Python\evil_programs\keylogger.py", line 6, in <module>
    import pyWinhook as pyHook
  File "C:\Users\myuser\AppData\Roaming\Python\Python310\site-packages\pyWinhook\__init__.py", line 1, in <module>
    from .HookManager import *
  File "C:\Users\myuser\AppData\Roaming\Python\Python310\site-packages\pyWinhook\HookManager.py", line 1, in <module>
    from . import cpyHook
ImportError: cannot import name 'cpyHook' from partially initialized module 'pyWinhook' (most likely due to a circular import) (C:\Users\myuser\AppData\Roaming\Python\Python310\site-packages\pyWinhook\__init__.py)

Thanks in advance

【问题讨论】:

  • Never mind. I fixed it.
  • can you please check share how you fix it?
  • I'm not quite sure. I just uninstalled and installed it or something.

标签: python-3.x python-import


【解决方案1】:

The way I fixed this is by installing Python 3.8.

Python 3.10 and 3.11 produced this issue.

I got this idea from the executable name on GitHub "pyWinhook-1.6.2.win-amd64-py3.8.exe"

Why it does not work with newer python, I have no clue.

【讨论】:

    猜你喜欢
    • 2019-07-20
    • 2020-07-16
    • 2019-06-10
    • 2014-09-25
    • 2014-01-02
    • 1970-01-01
    • 1970-01-01
    • 2020-05-29
    • 2018-11-13
    相关资源
    最近更新 更多