小编典典

pip install中“X的构建失败”是什么意思?

all

这是 SO 上一个非常受欢迎的问题,但我看过的许多答案都没有清楚地解释这个错误的真正含义以及它发生的原因。

混淆的一个来源是,当(例如)你这样做时pip install pycparser,你首先会得到错误:

Failed building wheel for pycparser

然后是包裹的消息:

Successfully installed pycparser-2.19.


# pip3 install pycparser

Collecting pycparser
  Using cached https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz
Building wheels for collected packages: pycparser
  Running setup.py bdist_wheel for pycparser ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-g_v28hpp/pycparser/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-__w_f6p0 --python-tag cp36:
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    ...
    File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2349, in resolve
      module = __import__(self.module_name, fromlist=['__name__'], level=0)
  ModuleNotFoundError: No module named 'wheel.bdist_wheel'

  ----------------------------------------
  Failed building wheel for pycparser
  Running setup.py clean for pycparser
Failed to build pycparser
Installing collected packages: pycparser
  Running setup.py install for pycparser ... done
Successfully installed pycparser-2.19

阅读 63

收藏
2022-07-14

共1个答案

小编典典

因为,除了我自己,似乎没有人提到这一点。我自己对上述问题的解决方案通常是确保使用以下方法禁用 缓存 副本: pip install<package> --no-cache-dir.

2022-07-14