pip install 无法安装后端依赖项

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

我重新启动了 Windows,在重新安装我的 python 软件包时,我不断遇到此错误

PS C:\Users\david> python3 -m pip install numpy
Collecting numpy
  Downloading numpy-2.2.1.tar.gz (20.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 20.2/20.2 MB 42.6 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install backend dependencies did not run successfully.
  │ exit code: 1
  ╰─> [133 lines of output]
      Collecting ninja>=1.8.2
        Downloading ninja-1.11.1.3.tar.gz (129 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Installing backend dependencies: started
        Installing backend dependencies: finished with status 'error'
        error: subprocess-exited-with-error

        pip subprocess to install backend dependencies did not run successfully.
        exit code: 1

        [108 lines of output]
        Collecting setuptools-scm
          Downloading setuptools_scm-8.1.0-py3-none-any.whl.metadata (6.6 kB)
        Collecting cmake>=3.15
          Downloading cmake-3.31.2.tar.gz (34 kB)
          Installing build dependencies: started
          Installing build dependencies: finished with status 'done'
          Getting requirements to build wheel: started
          Getting requirements to build wheel: finished with status 'done'
          Preparing metadata (pyproject.toml): started
          Preparing metadata (pyproject.toml): finished with status 'done'
        Collecting hatch-fancy-pypi-readme>=22.3
          Downloading hatch_fancy_pypi_readme-24.1.0-py3-none-any.whl.metadata (2.0 kB)
        Collecting packaging>=20 (from setuptools-scm)
          Using cached packaging-24.2-py3-none-any.whl.metadata (3.2 kB)
        Collecting setuptools (from setuptools-scm)
          Downloading setuptools-75.7.0-py3-none-any.whl.metadata (6.7 kB)
        Collecting hatchling (from hatch-fancy-pypi-readme>=22.3)
          Downloading hatchling-1.27.0-py3-none-any.whl.metadata (3.8 kB)
        Collecting pathspec>=0.10.1 (from hatchling->hatch-fancy-pypi-readme>=22.3)
          Using cached pathspec-0.12.1-py3-none-any.whl.metadata (21 kB)
        Collecting pluggy>=1.0.0 (from hatchling->hatch-fancy-pypi-readme>=22.3)
          Downloading pluggy-1.5.0-py3-none-any.whl.metadata (4.8 kB)
        Collecting trove-classifiers (from hatchling->hatch-fancy-pypi-readme>=22.3)
          Downloading trove_classifiers-2025.1.6.15-py3-none-any.whl.metadata (2.2 kB)
        Downloading setuptools_scm-8.1.0-py3-none-any.whl (43 kB)
        Downloading hatch_fancy_pypi_readme-24.1.0-py3-none-any.whl (10 kB)
        Using cached packaging-24.2-py3-none-any.whl (65 kB)
        Downloading hatchling-1.27.0-py3-none-any.whl (75 kB)
        Downloading setuptools-75.7.0-py3-none-any.whl (1.2 MB)
           ---------------------------------------- 1.2/1.2 MB 15.3 MB/s eta 0:00:00
        Using cached pathspec-0.12.1-py3-none-any.whl (31 kB)
        Downloading pluggy-1.5.0-py3-none-any.whl (20 kB)
        Downloading trove_classifiers-2025.1.6.15-py3-none-any.whl (13 kB)
        Building wheels for collected packages: cmake
          Building wheel for cmake (pyproject.toml): started
          Building wheel for cmake (pyproject.toml): finished with status 'error'
          error: subprocess-exited-with-error

          Building wheel for cmake (pyproject.toml) did not run successfully.
          exit code: 1

          [60 lines of output]
          Traceback (most recent call last):
            File "C:\msys64\ucrt64\lib\python3.11\urllib\request.py", line 1348, in do_open
              h.request(req.get_method(), req.selector, req.data, headers,
            File "C:\msys64\ucrt64\lib\python3.11\http\client.py", line 1294, in request
              self._send_request(method, url, body, headers, encode_chunked)
            File "C:\msys64\ucrt64\lib\python3.11\http\client.py", line 1340, in _send_request
              self.endheaders(body, encode_chunked=encode_chunked)
            File "C:\msys64\ucrt64\lib\python3.11\http\client.py", line 1289, in endheaders
              self._send_output(message_body, encode_chunked=encode_chunked)
            File "C:\msys64\ucrt64\lib\python3.11\http\client.py", line 1048, in _send_output
              self.send(msg)
            File "C:\msys64\ucrt64\lib\python3.11\http\client.py", line 986, in send
              self.connect()
            File "C:\msys64\ucrt64\lib\python3.11\http\client.py", line 1466, in connect
              self.sock = self._context.wrap_socket(self.sock,
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\msys64\ucrt64\lib\python3.11\ssl.py", line 517, in wrap_socket
              return self.sslsocket_class._create(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\msys64\ucrt64\lib\python3.11\ssl.py", line 1108, in _create
              self.do_handshake()
            File "C:\msys64\ucrt64\lib\python3.11\ssl.py", line 1383, in do_handshake
              self._sslobj.do_handshake()
          ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)

          During handling of the above exception, another exception occurred:

          Traceback (most recent call last):
            File "C:\msys64\ucrt64\lib\python3.11\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
              main()
            File "C:\msys64\ucrt64\lib\python3.11\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
              json_out['return_val'] = hook(**hook_input['kwargs'])
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\msys64\ucrt64\lib\python3.11\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel
              return _build_backend().build_wheel(wheel_directory, config_settings,
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\Users\david\AppData\Local\Temp\pip-install-asx64kyy\cmake_7260e98108244fe5aff2fac585dc6406\_build_backend\backend.py", line 156, in build_wheel
              cmake_path = _bootstrap_build(temp_path, config_settings)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\Users\david\AppData\Local\Temp\pip-install-asx64kyy\cmake_7260e98108244fe5aff2fac585dc6406\_build_backend\backend.py", line 103, in _bootstrap_build
              with urllib.request.urlopen(archive_url) as response:
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\msys64\ucrt64\lib\python3.11\urllib\request.py", line 216, in urlopen
              return opener.open(url, data, timeout)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\msys64\ucrt64\lib\python3.11\urllib\request.py", line 519, in open
              response = self._open(req, data)
                         ^^^^^^^^^^^^^^^^^^^^^
            File "C:\msys64\ucrt64\lib\python3.11\urllib\request.py", line 536, in _open
              result = self._call_chain(self.handle_open, protocol, protocol +
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\msys64\ucrt64\lib\python3.11\urllib\request.py", line 496, in _call_chain
              result = func(*args)
                       ^^^^^^^^^^^
            File "C:\msys64\ucrt64\lib\python3.11\urllib\request.py", line 1391, in https_open
              return self.do_open(http.client.HTTPSConnection, req,
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\msys64\ucrt64\lib\python3.11\urllib\request.py", line 1351, in do_open
              raise URLError(err)
          urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)>
          [end of output]

          note: This error originates from a subprocess, and is likely not a problem with pip.
          ERROR: Failed building wheel for cmake
        Failed to build cmake
        ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (cmake)
        [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: subprocess-exited-with-error

      pip subprocess to install backend dependencies did not run successfully.
      exit code: 1

      See above for output.

      note: This error originates from a subprocess, and is likely not a problem with pip.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install backend dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

我尝试过重新安装 pip 设置工具,清除 pip 缓存,甚至尝试卸载并重新安装 python。我使用的是 python 3.11.7.

无论我是安装到全局 python 环境还是 venv,都会发生这种情况。有什么建议吗?

python pip
1个回答
0
投票

我解决了这个问题,经过一段时间的挖掘,我发现我需要从我的路径中删除

\Scripts
并将python路径移动到PATH环境变量的顶部,因为Powershell在python 3.13.1之前读取
C:\mysys64\ucrt64\bin
。该文件夹中的python版本是3.11.7。

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