未能在MSYS2/mingw上使用PIP安装Python密码库

发布于 2025-01-30 07:10:32 字数 3475 浏览 5 评论 0 原文

    Collecting cryptography
  Downloading cryptography-37.0.2.tar.gz (585 kB)
     -------------------------------------- 585.4/585.4 kB 7.4 MB/s eta 0:00:00
  Installing build dependencies ... error
  error: subprocess-exited-with-error

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

  [41 lines of output]
  Collecting setuptools!=60.9.0,>=40.6.0
    Using cached setuptools-62.3.1-py3-none-any.whl (1.2 MB)
  Collecting wheel
    Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
  Collecting cffi>=1.12
    Using cached cffi-1.15.0.tar.gz (484 kB)
    Preparing metadata (setup.py): started
    Preparing metadata (setup.py): finished with status 'error'
    error: subprocess-exited-with-error

    python setup.py egg_info did not run successfully.
    exit code: 1

    [16 lines of output]
    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 34, in <module>
      File "C:/Users/####/AppData/Local/Temp/pip-install-myhhpkap/cffi_c72832fd79d3476b80c36655663d2237/setup.py", line 126, in <module>
        if sys.platform == "win32" and uses_msvc():
      File "C:/Users/####/AppData/Local/Temp/pip-install-myhhpkap/cffi_c72832fd79d3476b80c36655663d2237/setup.py", line 105, in uses_msvc
        return config.try_compile('#ifndef _MSC_VER\n#error "not MSVC"\n#endif')
      File "C:/msys64/mingw64/lib/python3.9/site-packages/setuptools/_distutils/command/config.py", line 225, in try_compile
        self._compile(body, headers, include_dirs, lang)
      File "C:/msys64/mingw64/lib/python3.9/site-packages/setuptools/_distutils/command/config.py", line 132, in _compile
        self.compiler.compile([src], include_dirs=include_dirs)
      File "C:/msys64/mingw64/lib/python3.9/site-packages/setuptools/_distutils/_msvccompiler.py", line 327, in compile
        self.initialize()
      File "C:/msys64/mingw64/lib/python3.9/site-packages/setuptools/_distutils/_msvccompiler.py", line 218, in initialize
        raise DistutilsPlatformError("--plat-name must be one of {}"
    distutils.errors.DistutilsPlatformError: --plat-name must be one of ('win32', 'win-amd64', 'win-arm32', 'win-arm64')
    [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.
  [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 build 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和setuptools都是完全最新的,我已经安装了生锈,并链接到 x86_64-pc-windows-gnu 工具链,并且我从VS.中拥有C ++工具。我什至尝试过完全重新安装MSYS2,它仍然每次都会给我同样的错误。我以前已经安装了此方法,所以我知道这是可能的,但是它在另一台机器上,但我没有遇到这个问题。对于如何安装此操作,我真的很茫然,因此对任何帮助都将不胜感激。

编辑:因此,经过更多的狩猎和搜索。我意识到有一个用于密码库的MSYS2软件包,您需要使用它,而不是尝试使用PIP。据我所知,在MSYS2环境中运行它而不是引起它的Windows终端而导致某种汇编错误。这是我使用

    Collecting cryptography
  Downloading cryptography-37.0.2.tar.gz (585 kB)
     -------------------------------------- 585.4/585.4 kB 7.4 MB/s eta 0:00:00
  Installing build dependencies ... error
  error: subprocess-exited-with-error

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

  [41 lines of output]
  Collecting setuptools!=60.9.0,>=40.6.0
    Using cached setuptools-62.3.1-py3-none-any.whl (1.2 MB)
  Collecting wheel
    Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
  Collecting cffi>=1.12
    Using cached cffi-1.15.0.tar.gz (484 kB)
    Preparing metadata (setup.py): started
    Preparing metadata (setup.py): finished with status 'error'
    error: subprocess-exited-with-error

    python setup.py egg_info did not run successfully.
    exit code: 1

    [16 lines of output]
    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 34, in <module>
      File "C:/Users/####/AppData/Local/Temp/pip-install-myhhpkap/cffi_c72832fd79d3476b80c36655663d2237/setup.py", line 126, in <module>
        if sys.platform == "win32" and uses_msvc():
      File "C:/Users/####/AppData/Local/Temp/pip-install-myhhpkap/cffi_c72832fd79d3476b80c36655663d2237/setup.py", line 105, in uses_msvc
        return config.try_compile('#ifndef _MSC_VER\n#error "not MSVC"\n#endif')
      File "C:/msys64/mingw64/lib/python3.9/site-packages/setuptools/_distutils/command/config.py", line 225, in try_compile
        self._compile(body, headers, include_dirs, lang)
      File "C:/msys64/mingw64/lib/python3.9/site-packages/setuptools/_distutils/command/config.py", line 132, in _compile
        self.compiler.compile([src], include_dirs=include_dirs)
      File "C:/msys64/mingw64/lib/python3.9/site-packages/setuptools/_distutils/_msvccompiler.py", line 327, in compile
        self.initialize()
      File "C:/msys64/mingw64/lib/python3.9/site-packages/setuptools/_distutils/_msvccompiler.py", line 218, in initialize
        raise DistutilsPlatformError("--plat-name must be one of {}"
    distutils.errors.DistutilsPlatformError: --plat-name must be one of ('win32', 'win-amd64', 'win-arm32', 'win-arm64')
    [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.
  [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 build 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 and setuptools are both completely up to date, I have rust installed, and linked to the x86_64-pc-windows-gnu toolchain, and I have the C++ tools from VS. I have even tried completely reinstalling msys2 and it still gives me the same error every single time. I have gotten this installed this way before so I know it is possible, but it was on a different machine and I didn't run into this issue. I am really at a loss as to how to get this installed so any help would be greatly appreciated.

Edit: So after a bit more hunting and searching. I realized that there is a msys2 package for the cryptography library that you need to use instead of trying to use pip. As far as I can tell there is some sort of compilation error that results from running it in the msys2 environment instead of a windows terminal that is causing it. Here is the package I used https://packages.msys2.org/package/mingw-w64-x86_64-python3-cryptography

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

快乐很简单 2025-02-06 07:10:32

将我的编辑移至答案:
因此,经过更多的狩猎和搜索。我意识到有一个用于密码库的MSYS2软件包,您需要使用它,而不是尝试使用PIP。据我所知,在MSYS2环境中运行它而不是引起它的Windows终端而导致某种汇编错误。这是我使用

Moving my edit to an answer:
So after a bit more hunting and searching. I realized that there is a msys2 package for the cryptography library that you need to use instead of trying to use pip. As far as I can tell there is some sort of compilation error that results from running it in the msys2 environment instead of a windows terminal that is causing it. Here is the package I used https://packages.msys2.org/package/mingw-w64-x86_64-python3-cryptography

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文