Win10 wxPython can be build with VS2019 or it's only possible with VS2015?

I have build python 3.95 with VS2019. And when i try to build wxPython, setup.py say:
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.2 or greater is required. Get it with "Microsoft C++ Build Tools

We have to build python and wxPython with VS2015 ?

Because of this lines in build.py, i suppose.

        cmd = "import setuptools, distutils.msvc9compiler as msvc; " \
              "arch = msvc.PLAT_TO_VCVARS[msvc.get_platform()]; " \
              "env = msvc.query_vcvarsall(msvc.VERSION, arch); " \
              "print(env)"

Visual Studio 2019 contains Visual C++ 14.2 compiler. The setuptools Python package version must be at least 34.4.0.
My setuptools pacake is:
setuptools.version
‘50.3.2’

Other exemple of the origin of the problem:
msvc.find_vcvarsall(14.2)
‘C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat’

Has to be something like that:
‘C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvarsx86_amd64.bat’

Here the result of vswhere.exe:

"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
Visual Studio Locator version 2.7.1+180c706d56 [query version 2.7.3111.17308]
Copyright (C) Microsoft Corporation. All rights reserved.

instanceId: 4d9f3acb
installDate: 13/05/2019 17:00:04
installationName: VisualStudio/16.10.2+31410.357
installationPath: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
installationVersion: 16.10.31410.357
productId: Microsoft.VisualStudio.Product.Community
productPath: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe
state: 4294967295
isComplete: 1
isLaunchable: 1
isPrerelease: 0
isRebootRequired: 0
displayName: Visual Studio Community 2019
description: IDE puissant, gratuit pour les étudiants, les contributeurs open source et les particuliers
channelId: VisualStudio.16.Release
channelUri: https://aka.ms/vs/16/release/channel
enginePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service
releaseNotes: https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes-v16.10#16.10.2
thirdPartyNotices: https://go.microsoft.com/fwlink/?LinkId=660909
updateDate: 2021-06-16T00:13:05.1223574Z
catalog_buildBranch: d16.10
catalog_buildVersion: 16.10.31410.357
catalog_id: VisualStudio/16.10.2+31410.357
catalog_localBuild: build-lab
catalog_manifestName: VisualStudio
catalog_manifestType: installer
catalog_productDisplayVersion: 16.10.2
catalog_productLine: Dev16
catalog_productLineVersion: 2019
catalog_productMilestone: RTW
catalog_productMilestoneIsPreRelease: False
catalog_productName: Visual Studio
catalog_productPatchVersion: 2
catalog_productPreReleaseMilestoneSuffix: 1.0
catalog_productSemanticVersion: 16.10.2+31410.357
catalog_requiredEngineVersion: 2.10.2174.31177
properties_campaignId: Unity3d_Unity
properties_channelManifestId: VisualStudio.16.Release/16.10.2+31410.357
properties_nickname:
properties_setupEngineFilePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installershell.exe

instanceId: 959f1139
installDate: 19/11/2017 02:05:17
installationName: VisualStudio/15.9.36+28307.1525
installationPath: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
installationVersion: 15.9.28307.1525
productId: Microsoft.VisualStudio.Product.Community
productPath: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe
state: 4294967295
isComplete: 1
isLaunchable: 1
isPrerelease: 0
isRebootRequired: 0
displayName: Visual Studio Community 2017
description: Interface IDE gratuite et riche en fonctionnalités pour les étudiants et les développeurs open source et individuels
channelId: VisualStudio.15.Release
channelPath: C:\Users\Pierre\AppData\Local\Microsoft\VisualStudio\Packages\_Channels\4CB340F5\catalog.json
channelUri: https://aka.ms/vs/15/release/channel
enginePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service
releaseNotes: https://go.microsoft.com/fwlink/?LinkId=660692#15.9.36
thirdPartyNotices: https://go.microsoft.com/fwlink/?LinkId=660708
updateDate: 2021-06-16T07:58:12.3875663Z
catalog_buildBranch: d15.9
catalog_buildVersion: 15.9.28307.1525
catalog_id: VisualStudio/15.9.36+28307.1525
catalog_localBuild: build-lab
catalog_manifestName: VisualStudio
catalog_manifestType: installer
catalog_productDisplayVersion: 15.9.36
catalog_productLine: Dev15
catalog_productLineVersion: 2017
catalog_productMilestone: RTW
catalog_productMilestoneIsPreRelease: False
catalog_productName: Visual Studio
catalog_productPatchVersion: 36
catalog_productPreReleaseMilestoneSuffix: 1.0
catalog_productRelease: RTW
catalog_productSemanticVersion: 15.9.36+28307.1525
catalog_requiredEngineVersion: 1.18.1063.29791
properties_campaignId:
properties_canceled: 0
properties_channelManifestId: VisualStudio.15.Release/15.9.36+28307.1525
properties_nickname:
properties_setupEngineFilePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installershell.exe

BuildTools is here: (WindowsCompilers - Python Wiki)

"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools

A better solution would be to use Python3.9.5/PCbuild/find_msbuild.bat and not to use this useless tool distutils.msvc9compiler.

Have you tried with Visual Studio Code app? I had no problem with Windows 10.

Can you manually specify the compiler at wxPython/setup.py?
Because I have VSCode(1.21.0), Visual Studio Build Tools 2016 (16.10.2), 2015 express, 2017 express (15.9.36) and 2019 express (16.10.2) installed.
Calling vcvarsx86_amd64.bat before calling setup.py doesn’t help. Setup.py uses distutils.msvc9compiler and this one on my machine still wants the same VS140 compiler.
I compile python first. This one uses Python3.9.5/PCbuild/find_msbuild.bat which returns the latest VS compiler. That is in my case VS2019. Then I call setup.py with “venv” created by the same python I compiled. I specify to wxPython/setup.py the path of the python I compiled via the --python command.

I tried to compile this without VS2015 present. It didn’t change the problem. The only solution I see is to modify Python3.9.5/PCbuild/find_msbuild.bat to compile python with VS2015.
However I don’t want to uninstall VS2019 and VS2017 every time I want to recompile wxPython.

Translated with www.DeepL.com/Translator (free version)