在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__'], …Run Code Online (Sandbox Code Playgroud) 当我尝试“pip install pyaudio”时,我收到了该错误。\n我收到了“pip install numpy”和“pip install wheel”,但这些并没有解决我的问题。
\n\n\npip 版本:23.2.1\npython 版本:3.12.0
\n
C:\\Users\\admin!>pip install pyaudio\nCollecting pyaudio\n Using cached PyAudio-0.2.13.tar.gz (46 kB)\n Installing build dependencies ... done\n Getting requirements to build wheel ... error\n error: subprocess-exited-with-error\n\n \xc3\x97 Getting requirements to build wheel did not run successfully.\n \xe2\x94\x82 exit code: 1\n \xe2\x95\xb0\xe2\x94\x80> [33 lines of output]\n Traceback (most recent call last):\n File "C:\\Users\\admin!\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\pip\\_vendor\\pyproject_hooks\\_in_process\\_in_process.py", line 353, in <module>\n main()\n File "C:\\Users\\admin!\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\pip\\_vendor\\pyproject_hooks\\_in_process\\_in_process.py", line 335, in main\n json_out['return_val'] = hook(**hook_input['kwargs'])\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\\Users\\admin!\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\pip\\_vendor\\pyproject_hooks\\_in_process\\_in_process.py", …Run Code Online (Sandbox Code Playgroud) 今天我从 ppa 存储库ppa:deadsnakes/ppa在 Ubuntu 22.04 上安装了新的 Python 3.12 ,一切正常,但是当我尝试使用命令python3.12 -m pip install somelibrary安装某些库时,出现以下错误
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 165, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 205, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 285, in run
session = self.get_default_session(options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 75, in get_default_session
self._session = self.enter_context(self._build_session(options))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 89, in _build_session
session = PipSession(
^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/pip/_internal/network/session.py", line 282, in __init__ …Run Code Online (Sandbox Code Playgroud)