Qt5 qmake-找不到合适的Python 2版本

Qt5 qmake-找不到合适的Python 2版本,python,compiler-errors,qt5,Python,Compiler Errors,Qt5,我的目标是从源代码构建QtWebEngine,以下步骤是我为尝试实现这一目标所做的工作。我得到一个关于Python 2找不到的错误 到目前为止,我安装了什么: Qt5.12.6(从他们的在线安装程序-源代码,msvc2017,msvc2017\u 64,msvc2015,qtwebengine) Microsoft Visual Studio 2019(来自其网站) Python2.7.17和Python3.8.0(2.7.17用于编译Qt的部分,3.8.0用于一般编码-都来自Python.o

我的目标是从源代码构建QtWebEngine,以下步骤是我为尝试实现这一目标所做的工作。我得到一个关于Python 2找不到的错误

到目前为止,我安装了什么:

  • Qt5.12.6
    (从他们的在线安装程序-
    源代码
    msvc2017
    msvc2017\u 64
    msvc2015
    qtwebengine
  • Microsoft Visual Studio 2019
    (来自其网站)
  • Python2.7.17
    Python3.8.0
    (2.7.17用于编译Qt的部分,3.8.0用于一般编码-都来自
    Python.org
我需要从源代码重建
QtWebEngine
,为此,我按照以下步骤在
CMD
中键入以下内容,并在每个项目符号后按enter键:

  • cd“c:\ProgramFiles(x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build”
  • vcvars64.bat
此命令的输出为:

**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.2.0
** Copyright (c) 2019 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
  • cd\
  • cd Qt\5.12.6\Src\qtwebengine
  • “C:\Qt\5.12.6\msvc2017\u 64\bin\qmake.exe”--webengine专有编解码器
最后一个要点的输出是:

Running configuration tests...
Done running configuration tests.

Configure summary:

Qt WebEngine:
  Embedded build ......................... no
  Full debug information ................. no
  Pepper Plugins ......................... yes
  Printing and PDF ....................... yes
  Proprietary Codecs ..................... yes
  Spellchecker ........................... yes
  Native Spellchecker .................... no
  WebRTC ................................. yes
  Use System Ninja ....................... no
  Geolocation ............................ yes
  WebChannel support ..................... yes
  Use v8 snapshot ........................ yes
  Kerberos Authentication ................ yes

WARNING: Python version 2 (2.7.5 or later) is required to build QtWebEngine.

Qt is now configured for building. Just run 'nmake'.
Once everything is built, you must run 'nmake install'.
Qt will be installed into 'C:\Qt\5.12.6\msvc2017_64'.

Prior to reconfiguration, make sure you remove any leftovers from
the previous build.


A suitable version of python2 could not be found.
QtWebEngine will not be built.
我已经从Python.org安装了python2.7.17,它的文件位置是
C:\Python27
。 文件路径:

C:\Python27
C:\Python27\scripts
都按该顺序位于路径
。我还将2个
python3.8.0
文件夹(同上)存储在
PATH
中,位于
python2.7.17
文件夹上方。 我运行的是
windows10(64位)


当我尝试构建
QtWebEngine
时,为了让
Qt5.12.6
能够识别
Python 2.7.17
,我必须做些什么?

从PATH中删除Python 3.8.0。 参考 官方Qt文档中提到了以下内容 " 在所有平台上,都需要以下工具:

Python2.7.5或更高版本。不支持Python3。 野牛 GPerf 窗户 在Windows上,需要以下附加工具:

Visual Studio 2017版本15.8或更高版本 Windows10SDK Qt WebEngine只能在64位Windows上使用x64位工具链构建。要为x86应用程序构建Qt WebEngine,您需要使用Visual Studio 2017 x64到x86交叉编译工具链配置和编译Qt。可以通过运行vcvarsall.bat amd64_x86在命令行上设置此工具链。 "

注意:在Qt5.15构建要求中,它提到
使用Python 2.7.5或更高版本。Python 3不受支持。

我遇到了相同的错误。在qt5存储库的
config.log
中搜索“executing config test webengine-python2”以获取更多详细信息。打开CMD并通过以下方式检查pyhon2.exe/python.exe的位置:

where python2
where python
只能设置这两个选项中的一个“python2”有时用于避免名称冲突

可能
C:\Users\[USERNAME]\AppData\Local\Microsoft\WindowsApps
或Python 3会隐藏您的安装。您可以通过对
PATH
环境变量的条目重新排序来解决这个问题。将两个Python2安装文件夹放在“WindowsApps”和“python3”文件夹上方。除了修改
路径
环境变量外,还可以在CMD temporary中将它们设置在前面:

set PATH=C:\Python27\Scripts;C:\Python27;%PATH%
执行此操作后,请进行清理签出或清理当前qt5存储库,因为对我而言,qmake的缓存未通过重新配置进行更新:

git submodule foreach --recursive "git clean -dfx"
git clean -dfx

将python.exe添加到路径不能将exe添加到路径,仅文件夹不能添加到I?虽然此链接可以回答问题,但最好在此处包含答案的基本部分,并提供链接以供参考。如果链接页面发生更改,则仅链接的答案可能无效。