Windows10 64位Python2.7环境下SIP与PyQt4安装故障求助
Hey there, let's sort out that make command not recognized issue you're hitting while trying to install SIP and PyQt4 from source on your Windows 10 64-bit system with Python 2.7.14 (Anaconda 2.7.14). Here's the breakdown and fixes:
make Command Fails Windows doesn't come with the GNU make tool preinstalled—it's a utility designed for Unix-like systems (Linux/macOS). When you try running make in CMD, your system has no idea what that command means, hence the error. To compile SIP and PyQt4 from source, you'll either need to use a Windows-compatible compilation toolchain, or take the much easier route with Anaconda's package manager.
Since you're already using Anaconda, you can skip the entire source compilation hassle by installing pre-built packages directly. Here's how:
- Open the Anaconda Prompt (not regular CMD—this ensures your Anaconda environment is properly configured).
- Run this command to install SIP 4.19.7 and PyQt4:
conda install -c conda-forge sip=4.19.7 pyqt=4
This will handle all dependencies and installation automatically, no manual compilation needed.
If you absolutely need to compile from source (e.g., for custom modifications), follow one of these two options:
Option A: Use MinGW-w64
MinGW-w64 provides a GNU-compatible toolchain for Windows, including mingw32-make (the Windows equivalent of make):
- Download MinGW-w64 (pick the 64-bit version with the posix thread model and seh exception handling for best compatibility).
- Install it to a directory without spaces (e.g.,
C:\mingw-w64). - Add the MinGW-w64
binfolder (likeC:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin) to your system PATH environment variable. - Restart your CMD or Anaconda Prompt to apply the PATH changes.
- Navigate back to your SIP source folder, then run:
python configure.py mingw32-make mingw32-make install
Use mingw32-make instead of make—this is the MinGW equivalent that your system will recognize.
Option B: Use Microsoft Visual C++ Compiler for Python 2.7
Microsoft released a dedicated compiler for Python 2.7, which works well with PyQt4:
- Download and install the Microsoft Visual C++ Compiler for Python 2.7 (it's a free tool from Microsoft).
- Open the Visual C++ 2010 x64 Native Tools Command Prompt (this comes with the installer, and it pre-configures the compiler environment for 64-bit builds).
- Navigate to your SIP source folder, then run:
python configure.py --platform win32-msvc2010 nmake nmake install
Here, nmake is Microsoft's equivalent of make, and we specify the MSVC platform for the configure script to generate the correct Makefile.
A quick heads-up: Python 2.7 and PyQt4 are both end-of-life, so if possible, consider upgrading to a newer Python version and PyQt5/PyQt6 for better support and security. But if you're stuck with this environment, the above steps should get you sorted.
内容的提问来源于stack exchange,提问作者Ibrahem Mohamed

