【发布时间】:2020-07-13 22:01:51
【问题描述】:
我有一个旧版本的 MSYS2/MinGW,它使用 PyInstaller 和 Python3.7 在 Windows 中编译 C GTK 应用程序(绘图脚本需要 python)并且一切正常,直到 pacman 拒绝更新任何包,因为我一直收到错误:
error: hook /usr/share/libalpm/hooks/mingw-w64-x84_64-gtk-query-immodules-3.0.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/mingw-w64-x84_64-gtk-update-icon-cache.hook line 2: invalid value Path
Errors occurred, no packages were upgraded.
我查了这些,一般的回答是:“这个问题通常是在你没有定期维护你的系统时引发的——我不是每年都在考虑——因为这种忽视通常会导致类似的问题。问题源于 pacman 代码的更改..."
所以我决定从一个全新的 MSYS2 安装开始,并在 MSYS2 shell 和 MinGW-x64 shell 中使用以下行,但它们中的每一个都在不同的点上失败:
pacman -Syu
pacman -Su
pacman -S nano
pacman -S mingw-w64-i686-gtk3
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-gtk3 mingw-w64-x86_64-python3 mingw-w64-x86_64-python3-gobject
pacman -S --needed base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain git subversion mercurial mingw-w64-i686-cmake mingw-w64-x86_64-cmake
pacman -S python3-pip
pacman -S mingw-w64-x86_64-python3-pip
pacman -S msys2-devel
pacman -S mingw-w64-x86_64-glade
pacman -S mingw-w64-x86_64-gobject-introspection
pip install pyinstaller
对于 MSYS2 shell,pip install pyinstaller 失败并显示:
# pip install pyinstaller
Collecting pyinstaller
Using cached PyInstaller-3.6.tar.gz (3.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.exe /usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpd9hk1ekp
cwd: /tmp/pip-install-ouq11vnr/pyinstaller
Complete output (1 lines):
Your platform is not yet supported. Please define constant PYDYLIB_NAMES for your platform.
互联网搜索显示此问题出现在 PyInstaller 的 github 页面和此处的帖子中,两者都没有远程启发:
https://github.com/pyinstaller/pyinstaller/issues/4542
How to fix: PyInstaller in MSYS2 MinGW 'Your platform is not yet supported'
在 MinGW shell 的情况下,我可以安装一切正常,但我无法编译 C 代码,因为我收到错误:
fatal error: sys/wait.h: No such file or directory
7 | #include <sys/wait.h>
| ^~~~~~~~~~~~
compilation terminated.
这意味着 MinGW 不知道去哪里寻找这个文件。它位于:
msys64/usr/include/sys
但我想这仅适用于 MSYS2 shell?然而,我一岁的 MinGW shell 将编译 C 代码而不会出现此错误,但尽管付出了一切努力(按照 bash 历史记录为工作版本安装包,手动复制包文件夹,不断地)我继续遇到这个问题错误。只是将上面的文件夹复制到 MinGW 包含文件夹中会导致进一步的问题,并且显然是草率的。我想要一种可重复的方法来让它工作,我已经在几台计算机上重复了上面概述的过程并且每次都得到完全相同的结果 - 所以我希望任何从新安装 MSYS2 开始的人都会遇到同样的问题。非常感谢任何帮助使其运行的帮助,因为我对所有死胡同感到沮丧。
【问题讨论】:
-
用“i686”替换所有“x86_64”导致
pip install pyinstaller在MinGW环境中失败,在MSYS2中出现同样的问题。
标签: python c mingw pyinstaller msys2