Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Compile wxPython 4.1.2a1 using Microsoft C++ Build Tools 2019

Use case:

  • Windows 11 Dev Channel
  • GnuWin32: Make winget install -e --id GnuWin32.Make
  • Windows Subsystem for Linux 2
➜ wsl --version
WSL version:
Kernel version:
WSLg version: 1.0.29
Windows version: 10.0.22523.1000


sudo apt install -y graphviz
sudo apt install -y doxygen
  • Create the hard links for setuptools.msvc:EnvironmentInfo.VCRuntimeRedist
mklink /j "C:\Program Files (x86)\Microsoft Visual Studio 14.2" "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
mklink /j "C:\Program Files (x86)\Microsoft Visual Studio 14.2\VC\Redist\MSVC\v142\onecore" "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Redist\MSVC\14.29.30133\onecore"

Apply patch to

From 8c97512543a48c75a43a683fb962fb17d937c245 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Oleksis=20Fraga=20Men=C3=A9ndez?= <>
Date: Wed, 22 Dec 2021 01:44:46 -0500

--- | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ b/
index 7269d9591..6903d20c0 100755
--- a/
+++ b/
@@ -973,6 +973,15 @@ def _doDox(arg):
         d = posixjoin(wxDir(), 'docs/doxygen')
         d = d.replace('\\', '/')
         cmd = '"{}" -l -c "cd {} && ./ {}"'.format(bash, d, arg)
+        # If use Bash.exe and Doxygen.exe in WSL2
+        # os.environ["PATH"] = os.path.dirname(os.environ['DOXYGEN']) + ";" + os.environ["PATH"]
+        # cmd = '"{}" -l -c "cd {} && WX_SKIP_DOXYGEN_VERSION_CHECK=1 DOXYGEN="{}" ./ {}"'.format(bash, d, os.environ['DOXYGEN'], arg)
+        # Use WSL2
+        # Need install in the default distro doxygen and graphviz
+        if which('wsl'):
+            d = dos2bashPath(d)
+            cmd = '"{}" -l -c "cd {} && WX_SKIP_DOXYGEN_VERSION_CHECK=1 ./ {}"'.format(bash, d, arg)
         os.environ['DOXYGEN'] = doxCmd
         os.environ['WX_SKIP_DOXYGEN_VERSION_CHECK'] = '1'
powershell.exe /C "Write-Output $(Invoke-WebRequest -URI -UseBasicParsing).RawContent | git apply -"

Build wxPython on Windows

  • Using x86_x64 Cross Tools Command Prompt for VS 2019 (Run as Administrator)
gh repo clone wxWidgets/Phoenix
cd .\Phoenix\
git submodule update --init --recursive
%LOCALAPPDATA%\Programs\Python\Python310\python.exe -m venv venv
pip install -r .\requirements.txt
python dox etg --nodoc sip build

Create wheel

python bdist_wheel

Test wxPython

pip install dist\wxPython-4.1.2a1-cp310-cp310-win_amd64.whl
python -c "import wx; print(wx.version());"


python -u clean


  • Handle the case of using bash and wsl with doxygen and graphviz from Windows

Download wheel



  • Python 3.10.1 , Packages in WSL2
  • Clone this branch with the integrated pyMSVC package and the patches
  • Now we don't need to use the "x86_x64 Cross Tools Command Prompt for VS 20xy"
  • Don't need create the hard links

Build wxPython on Windows

gh repo clone wxWidgets/Phoenix
cd .\Phoenix\
git submodule update --init --recursive
# ~\cpython\PCbuild\amd64\python.exe -m venv venv
# .\venv\Scripts\activate
python -m pip install -r .\requirements.txt
python dox etg --nodoc sip build


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment