我正在尝试win32core使用 pip 安装模块,但它不断显示有关包/轮元数据与文件名不匹配(版本不一致)的警告。
以下是下载旧版本之前命令提示符中显示的文本片段:
\npython -m pip install --no-cache-dir win32core\nCollecting win32core\n Downloading win32core-221.28.tar.gz (2.1 MB)\n |\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88| 2.1 MB 2.2 MB/s\n Installing build dependencies ... done\n Getting requirements to build wheel ... done\n Preparing wheel metadata ... done\nWARNING: Discarding https://files.pythonhosted.org/packages/24/\n0a6e0b2e201c76ccd3cda1f97bd64d45daa2b899b50e541962748ec5bc9f5d/\nwin32core-221.28.tar.gz#\nsha256=e805548ccde99a3f36931d3eef72cfaaa5dace4288393af898c96f92c1fe5f9e (from https://pypi.org/simple/win32core/).\nRequested win32core from https://files.pythonhosted.org/packages/\n24/0a/6e0b2e201c76ccd3cda1f97bd64d45daa2b899b50e541962748ec5bc9f5d/win32core-221.28.tar.gz#\nsha256=e805548ccde99a3f36931d3eef72cfaaa5dace4288393af898c96f92c1fe5f9e\nhas inconsistent version: filename has '221.28', but metadata has '0.0.0'\nRun Code Online (Sandbox Code Playgroud)\n我以前遇到过这种情况,我应该如何正确安装模块?(我使用的是Python 3.9.1)
\nKoc*_*ise 33
Pip 更改了版本解析器中的规则,现在更加严格。
查看讨论:
https://github.com/pypa/pip/issues/9186
https://github.com/pypa/pip/issues/9203
尝试使用:
python -m pip install --upgrade --no-cache-dir --use-deprecated=legacy-resolver <your_package>
Run Code Online (Sandbox Code Playgroud)
Way*_*oor 11
如果您遇到这样的问题,可能是由于站点包文件夹中的目录为空。以下命令将修复该问题:
find /opt/homebrew/lib/python3.11/site-packages -empty -type d -delete
Run Code Online (Sandbox Code Playgroud)