当前位置:   article > 正文

【python自动化】01.安装配置库和环境之win32gui安装失败(保姆级图文)

win32gui安装失败
目录
    • 报错效果
    • 解决方法
      • 安装win32库(到这里其实就能用,下面的2点是不想飘红)
      • 不要在项目路径中出现中文(基本上到这一步就能解决问题)
    • 总结

『python自动化』分享win32gui、cv2、easyocr等库相关的新手入门教程,目标是编写python程序进行自动化办公,解放双手。

我是在独立的项目虚拟环境中安装配置各个库,其他的库基本上都能pip install解决,只有在安装win32gui库的时候遇到了困难,

报错效果

在这里插入图片描述

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting win32gui
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/b8/75/7bed82934e51903f9d48b26b3996161bb2dce1731607b4bb7fd26003ed3e/win32gui-221.5.tar.gz (605 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [19 lines of output]
      Traceback (most recent call last):
        File "e:\allworkspace\python work space\python纯图色脚本\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
          main()
        File "e:\allworkspace\python work space\python纯图色脚本\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "e:\allworkspace\python work space\python纯图色脚本\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "C:\Users\ASUS\AppData\Local\Temp\pip-build-env-5gya8ave\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "C:\Users\ASUS\AppData\Local\Temp\pip-build-env-5gya8ave\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "C:\Users\ASUS\AppData\Local\Temp\pip-build-env-5gya8ave\overlay\Lib\site-packages\setuptools\build_meta.py", line 482, in run_setup
          super(_BuildMetaLegacyBackend,
        File "C:\Users\ASUS\AppData\Local\Temp\pip-build-env-5gya8ave\overlay\Lib\site-packages\setuptools\build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 27, in <module>
        File "C:\Users\ASUS\AppData\Local\Temp\pip-install-kiw84dvk\win32gui_712b634add45492f8cc5b815a960773e\win32\distutils\gui.py", line 6, in <module>
          from .command import win32_build_ext
      ModuleNotFoundError: No module named 'win32.distutils.command'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40

解决方法

安装win32库(到这里其实就能用,下面的2点是不想飘红)

这里安装pywin32库就可以使用win32gui等库,我一开始还想直接安装win32gui,卡住了半天。

在这里插入图片描述

不要在项目路径中出现中文(基本上到这一步就能解决问题)

强调!!!PyCharm里的项目和路径最好不要包含中文!!!
在这里插入图片描述

没有飘红
在这里插入图片描述


总结

大家喜欢的话,给个

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/109255
推荐阅读
相关标签