You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在macOS High Sierra上安装wxGTK 3.0.20、wxPython 3.0.2.0及wxWidgets?

Installing wxGTK 3.0.20, wxPython 3.0.2.0, and GTK-based wxWidgets on macOS High Sierra

Hey there! Let's walk through getting these components set up on your High Sierra system. I've worked through similar legacy setup issues before, so here's a detailed, step-by-step guide to help you out:

Prerequisites First

Before diving in, make sure you have these basics covered:

  • Install Xcode Command Line Tools: Run xcode-select --install in Terminal and follow the prompts.
  • Install Homebrew (if you don't already have it):
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
    Note: High Sierra is an older macOS version, so Homebrew might prompt you to switch to a legacy branch if needed—just follow the on-screen instructions.

Step 1: Install GTK+3 and Dependencies

wxGTK relies on GTK+3, so let's install that first along with essential build tools:

brew install gtk+3 pkg-config libpng jpeg

This will pull in all the core libraries needed for compiling wxGTK.

Step 2: Compile and Install wxGTK 3.0.20

Since Homebrew doesn't package this specific older version of wxGTK, we'll build it from source:

  1. Download the wxWidgets 3.0.20 source archive (you can grab this from the wxWidgets official releases page, look for the .tar.bz2 package)
  2. Extract the archive in your Terminal:
    tar -xjf wxWidgets-3.0.20.tar.bz2
    cd wxWidgets-3.0.20
    
  3. Configure the build for GTK+3 (we'll install it to /usr/local for system-wide access):
    CC=clang CXX=clang++ ./configure --with-gtk=3 --prefix=/usr/local --enable-unicode --enable-debug=no --enable-shared
    
    The CC and CXX flags ensure we use Clang, which is the recommended compiler for macOS.
  4. Compile and install (the -j4 flag uses 4 CPU cores—adjust this based on your machine's specs):
    make -j4
    sudo make install
    
  5. Verify the installation by checking the wx-config version:
    wx-config --version
    
    It should output 3.0.20.

Step 3: Install wxPython 3.0.2.0

A quick heads-up: wxPython 3.0.2.0 is officially built against wxWidgets 3.0.2, so there's a minor version mismatch here that could cause subtle compatibility issues. If possible, consider pairing wxPython 3.0.2.0 with wxGTK 3.0.2 instead. But if you need the exact versions specified, proceed with these steps:

  1. Download the wxPython 3.0.2.0 source archive for macOS High Sierra (look for the package targeted at 10.13 in the wxPython archives)
  2. Extract and navigate to the source directory:
    tar -xjf wxPython-3.0.2.0.tar.bz2
    cd wxPython-3.0.2.0
    
  3. Set up the environment so the build system can find wxGTK:
    export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
    
  4. Install wxPython (note: this uses the system's default Python 2.7, which wxPython 3.0.2.0 supports—Python 3 compatibility isn't guaranteed here):
    sudo python setup.py install
    

Step 4: Test Your Installation

To confirm everything works, open a Python shell and run this simple test script:

import wx
app = wx.App()
frame = wx.Frame(None, title="wxPython GTK Test")
frame.Show()
app.MainLoop()

If a small window titled "wxPython GTK Test" pops up, you're all set!

Troubleshooting Tips

  • If you run into compile errors, double-check that all dependencies from Step 1 are installed.
  • If wx-config isn't found after installing wxGTK, add /usr/local/bin to your PATH with export PATH="/usr/local/bin:$PATH".
  • For version mismatch warnings between wxGTK and wxPython, consider downgrading wxGTK to 3.0.2 to match wxPython 3.0.2.0—just adjust the source download to the 3.0.2 release.

内容的提问来源于stack exchange,提问作者c1der c1der

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:39:21