使用“pip install --cert”安装时出现错误“error: subprocess-exited-with-error”

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

我尝试使用 anaconda 提示符进行安装,

pip --cert“D:\DDownloads\MyCert.pem”安装 tflite_support

最终出现错误,

  Collecting tflite_support
  Using cached tflite-support-0.1.0a1.tar.gz (390 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [58 lines of output]
      D:\AI\Anaconda\Lib\site-packages\setuptools\__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.fetch_build_eggs(dist.setup_requires)
      WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)'))': /simple/pybind11/
      WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)'))': /simple/pybind11/
      WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)'))': /simple/pybind11/
      WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)'))': /simple/pybind11/
      WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)'))': /simple/pybind11/
      ERROR: Could not find a version that satisfies the requirement pybind11>=2.4 (from versions: none)
      ERROR: No matching distribution found for pybind11>=2.4
      Traceback (most recent call last):
        File "D:\AI\Anaconda\Lib\site-packages\setuptools\installer.py", line 96, in _fetch_build_egg_no_warn
          subprocess.check_call(cmd)
        File "D:\AI\Anaconda\Lib\subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['D:\\AI\\Anaconda\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\user.sk\\AppData\\Local\\Temp\\tmpfjgjp7hu', '--quiet', 'pybind11>=2.4']' returned non-zero exit status 1.

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\user.sk\AppData\Local\Temp\pip-install-ok_9cx2o\tflite-support_76f7e4f7f27f407ba020192d982c23a5\setup.py", line 143, in <module>
          setup(
        File "D:\AI\Anaconda\Lib\site-packages\setuptools\__init__.py", line 106, in setup
          _install_setup_requires(attrs)
        File "D:\AI\Anaconda\Lib\site-packages\setuptools\__init__.py", line 79, in _install_setup_requires
          _fetch_build_eggs(dist)
        File "D:\AI\Anaconda\Lib\site-packages\setuptools\__init__.py", line 84, in _fetch_build_eggs
          dist.fetch_build_eggs(dist.setup_requires)
        File "D:\AI\Anaconda\Lib\site-packages\setuptools\dist.py", line 907, in fetch_build_eggs
          return _fetch_build_eggs(self, requires)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "D:\AI\Anaconda\Lib\site-packages\setuptools\installer.py", line 38, in _fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "D:\AI\Anaconda\Lib\site-packages\pkg_resources\__init__.py", line 829, in resolve
          dist = self._resolve_dist(
                 ^^^^^^^^^^^^^^^^^^^
        File "D:\AI\Anaconda\Lib\site-packages\pkg_resources\__init__.py", line 865, in _resolve_dist
          dist = best[req.key] = env.best_match(
                                 ^^^^^^^^^^^^^^^
        File "D:\AI\Anaconda\Lib\site-packages\pkg_resources\__init__.py", line 1135, in best_match
          return self.obtain(req, installer)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "D:\AI\Anaconda\Lib\site-packages\pkg_resources\__init__.py", line 1147, in obtain
          return installer(requirement)
                 ^^^^^^^^^^^^^^^^^^^^^^
        File "D:\AI\Anaconda\Lib\site-packages\setuptools\installer.py", line 98, in _fetch_build_egg_no_warn
          raise DistutilsError(str(e)) from e
      distutils.errors.DistutilsError: Command '['D:\\AI\\Anaconda\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\user.sk\\AppData\\Local\\Temp\\tmpfjgjp7hu', '--quiet', 'pybind11>=2.4']' returned non-zero exit status 1.
      [end of output]

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

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

如何解决这个问题?

请注意,我拥有之前已成功使用过的有效证书。

python installation pip package anaconda
1个回答
1
投票

问题出现在依赖安装过程中。 setuptools 似乎运行命令

'['D:\\AI\\Anaconda\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\user.sk\\AppData\\Local\\Temp\\tmpfjgjp7hu', '--quiet', 'pybind11>=2.4']'

根据

pybind11>=2.4
的要求安装
tflite-support-0.1.0a1
。如您所见,您在原始
--cert
命令中设置的
pip install
不再设置。我认为这是一个错误,但我并没有深入了解 pip/setuptools 的具体内部工作原理来判断谁是错的。

我可以想到两种可能的解决方法:

  1. 您可以手动安装依赖项,例如做
    pip install --cert pybind11>=2.4 "D:\DDownloads\MyCert.pem"
  2. 通过编辑 pip.conf 文件或运行
    python -m pip config set global.cert D:\DDownloads\MyCert.pem
  3. 在 pip 选项中设置证书
© www.soinside.com 2019 - 2024. All rights reserved.