无法为 Pillow、typed-ast 构建轮子,这是安装基于 pyproject.toml 的项目所必需的

问题描述 投票:0回答:1

我正在尝试运行一个旧项目,这是我的requirements.txt

asgiref==3.4.1
astroid==2.3.3
certifi==2019.11.28
chardet==3.0.4
Django==4.0.1
django-cleanup==5.2.0
idna==2.8
isort==4.3.21
lazy-object-proxy==1.4.3
mccabe==0.6.1
Pillow==9.0.0
requests==2.22.0
six==1.13.0
sqlparse==0.4.2
sslcommerz-python==0.0.7
typed-ast==1.4.0
tzdata==2021.5
urllib3==1.25.7
wrapt==1.11.2

在询问 chatgpt 之后,我还下载了带有 microsoft Visual C++ 2015-2022 Redistributable(x64、x86)的 Windows 软件开发套件。 这是我的 venv 中已经存在的软件包

Package    Version
---------- -------
pip        23.3.2
setuptools 65.5.0
typed-ast  1.5.5
wheel      0.42.0

我尝试运行这两个命令

pip install -r requirements.txt
pip install -r requirements.txt --use-pep517

但是出现错误

 error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for typed-ast
Failed to build Pillow typed-ast
ERROR: Could not build wheels for Pillow, typed-ast, which is required to install pyproject.toml-based projects

询问我是否需要任何其他信息。

python pip python-imaging-library install.packages
1个回答
0
投票

Pillow 9.0支持Python 3.7-3.10:

这意味着 Python 3.11 没有预编译的二进制轮子,因此 pip 正在下载源代码并尝试从源代码构建。

我建议不要在 Windows 上从源代码构建,它需要设置一个编译器,这可能很棘手。

相反,我建议将 Pillow 9.3+ 与 Python 3.11 结合使用,或将 Python 3.10 与 Pillow 9.0 结合使用。

同样,如果使用比旧项目原来使用的Python更新的Python,你可能会发现其他一些需求也需要升级;或者使用最初用于旧项目的相同旧 Python 版本。

© www.soinside.com 2019 - 2024. All rights reserved.