未能在MSYS2/mingw上使用PIP安装Python密码库
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终端而导致某种汇编错误。这是我使用
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将我的编辑移至答案:
因此,经过更多的狩猎和搜索。我意识到有一个用于密码库的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