无法识别 shiboken 版本 (5.15.2)

问题描述

我作为我的同事尝试在 Windows 上使用 shiboken + C++ + Qt 的组合,但它不起作用

控制台:来自 MVS 的 x86 管理员、QT 5.15.2、CMAKE 3.19.8

来自 MVS 安装程序 3.7 的 Python(使用路径:PYTHONHOME C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64,路径:C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64)

Shiboken 从 https://code.qt.io/cgit/pyside/pyside-setup.git/ 下载

cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug 
C:\Users\...qt-5.15.2\pyside-setup\sources\shiboken2\ -DBUILD_TESTS=False 
-DCMAKE_PREFIX_PATH='C:\Users\...\qt-5.15.2;' -DCMAKE_INSTALL_PREFIX='C:\Users\...\QT\shiboken2-debug' -
DPYTHON_EXECUTABLE='C:\ProgramFiles(x86)\MicrosoftVisualStudio\Shared\Python37_64\python_d.exe'

输出:

CMake Error at CMakeLists.txt:51 (message):
  Could not identify shiboken version.  Error:

当我更改 cmake 文件时,我发现很有趣:PYTHON_DEBUG_LIBRARIES 为空

检查cmakefile后,我可以看到无论cmake用python_d调用execute_process的任何地方,python都不起作用并返回null,python_d的路径是正确的。我在目录中有 python_d.exe。我尝试安装 python,而不是从 MVS 安装,结果相同。我尝试使用 3.9 python。我从旧的 python 版本中清除了 sys 路径。

解决方法

所以,谢谢同事,这是一个错误的路径 DPYTHON_EXECUTABLE,我在 Cmake 文件中添加消息以输出正确的路径,并成功使用。 "C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python37_64/python_d.exe"

之前我重新安装了MVS,但我认为没有任何影响

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...