我升级到Python3.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上,构建22000.194 (稳定的),这个问题即使在Win10上也发生了。
谢谢和问候,伊桑
发布于 2021-10-05 08:27:45
最新版本的pywin32
只有pypi上有whl文件,但这些版本上升到python3.9。这就是为什么您对python版本<=3.9没有任何问题。现在您已经到了3.10,pip
没有其他选择,只能返回版本列表并获取具有可用源代码包的最新版本。
从您的错误来看,上述版本似乎是用python2编写的。您可以尝试直接从pywin32
安装github源代码。
不过,请注意,目前python 3.10还很新,您可能会在一段时间内在其他包中遇到类似的问题。如果您不迫切需要3.10中的特性,那么最好还是坚持使用早期的python版本,并提供更好的支持。
发布于 2021-10-08 21:21:52
您可以从https://github.com/mhammond/pywin32/actions/runs/1250371344下载轮子文件,提取python3.10的轮子并使用pip安装它。车轮文件是一个拉链。
pip install pywin32-301.1-cp310-cp310-win_amd64.whl
https://stackoverflow.com/questions/69445168
复制相似问题