首页 > 解决方案 > 无法安装pypiwin32和win10toast

问题描述

我升级到 Python 3.10.0,但无法使用pip. 旧版本不存在此问题。

当我尝试时pip install pypiwin32,它会给出以下错误:

ERROR: Command errored out with exit status 1:
     command: 'C:\Users\username\AppData\Local\Programs\Python\Python310\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-d9m6kfyx\\pypiwin32_e35bdff1e22f442e83e718653c555e3a\\setup.py'"'"'; __file__='"'"'C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-d9m6kfyx\\pypiwin32_e35bdff1e22f442e83e718653c555e3a\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\username\AppData\Local\Temp\pip-pip-egg-info-c3dic37e'
         cwd: C:\Users\username\AppData\Local\Temp\pip-install-d9m6kfyx\pypiwin32_e35bdff1e22f442e83e718653c555e3a\
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\username\AppData\Local\Temp\pip-install-d9m6kfyx\pypiwin32_e35bdff1e22f442e83e718653c555e3a\setup.py", line 121
        print "Building pywin32", pywin32_version
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/2b/ca/5c086c18de8f70222787b3e824e755b68d99272531522e77bb381d4f60c8/pypiwin32-219.zip#sha256=06d478295c89dbdd4187e1ac099bb8eab93c29e298bded4e2fbc77009287fa44 (from https://pypi.org/simple/pypiwin32/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pywin32>=223 (from pypiwin32) (from versions: none)
ERROR: No matching distribution found for pywin32>=223

有没有办法解决这个问题?当我尝试安装win10toast.

任何帮助,将不胜感激。

如果您愿意:我使用的是Windows 11 build 22000.194(稳定版)即使我使用的是 Win10,也会出现此问题。

谢谢和问候, Ishaan

标签: pythonpip

解决方案


您可以从https://github.com/mhammond/pywin32/actions/runs/1250371344下载轮子文件,为 python 3.10 提取轮子并使用 pip 安装它。车轮文件是一个 zip。

pip install pywin32-301.1-cp310-cp310-win_amd64.whl

推荐阅读