问题描述
C:\Users\Viraj Sharma>pip install win32gui
Collecting win32gui
Using cached win32gui-221.5.tar.gz (605 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\viraj sharma\appdata\local\programs\python\python38\python.exe' 'c:\users\viraj sharma\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\VIRAJS~1\AppData\Local\Temp\tmpjn8lvta1'
cwd: C:\Users\Viraj Sharma\AppData\Local\Temp\pip-install-gcbm1r68\win32gui
Complete output (20 lines):
Traceback (most recent call last):
File "c:\users\viraj sharma\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py",line 280,in <module>
main()
File "c:\users\viraj sharma\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py",line 263,in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "c:\users\viraj sharma\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py",line 114,in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users\Viraj Sharma\AppData\Local\Temp\pip-build-env-9wmd0fza\overlay\Lib\site-packages\setuptools\build_Meta.py",line 149,in get_requires_for_build_wheel
return self._get_build_requires(
File "C:\Users\Viraj Sharma\AppData\Local\Temp\pip-build-env-9wmd0fza\overlay\Lib\site-packages\setuptools\build_Meta.py",line 130,in _get_build_requires
self.run_setup()
File "C:\Users\Viraj Sharma\AppData\Local\Temp\pip-build-env-9wmd0fza\overlay\Lib\site-packages\setuptools\build_Meta.py",line 253,in run_setup
super(_BuildMetaLegacyBackend,File "C:\Users\Viraj Sharma\AppData\Local\Temp\pip-build-env-9wmd0fza\overlay\Lib\site-packages\setuptools\build_Meta.py",line 145,in run_setup
exec(compile(code,__file__,'exec'),locals())
File "setup.py",line 27,in <module>
from win32.distutils.gui import win32gui_build_ext
File "C:\Users\Viraj Sharma\AppData\Local\Temp\pip-install-gcbm1r68\win32gui\win32\distutils\gui.py",line 6,in <module>
from .command import win32_build_ext
ModuleNotFoundError: No module named 'win32.distutils.command'
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\viraj sharma\appdata\local\programs\python\python38\python.exe' 'c:\users\viraj sharma\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\VIRAJS~1\AppData\Local\Temp\tmpjn8lvta1' Check the logs for full command output.
解决方法
Python 3.7或3.8与win32gui不兼容。
3.8已于2019年发布,最新版本的win32gui已于2017年8月发布。
我建议使用python 3.6或更低版本来使安装正常工作。
但是,还有另一种方法,通过安装(pip install pywin32)将在与Windows接口的模块旁边安装win32gui。
,您可以使用以下命令安装win32gui。
pip install pywin32