Windows10环境下pip安装mod_wsgi失败求助(IT编程新手)
Hey there, let's break down each of your mod_wsgi installation problems and fix them one by one—you’ve already put in great effort trying different solutions, so let’s get this sorted!
1. Fixing the Pip Parse Error for RAR Files
First up, that Invalid requirement error happens because pip can’t install directly from RAR archives. The file you downloaded is a compressed wheel (.whl) package inside a RAR, so you need to extract it first:
- Unzip the
C:/mod_wsgi-4.5.24+ap24vc14-cp37-cp37m-win_amd64.rarfile to a folder (e.g.,C:/mod_wsgi_unzipped). - Inside the extracted folder, you’ll find a
.whlfile (something likemod_wsgi-4.5.24+ap24vc14-cp37-cp37m-win_amd64.whl). - Run this command to install the wheel directly:
pip install C:/mod_wsgi_unzipped/mod_wsgi-4.5.24+ap24vc14-cp37-cp37m-win_amd64.whl
2. Resolving Linker Error & Mismatched Architecture Issues
The linker error exit status 1120 and your initial VC14 installation issues are almost certainly caused by a bitness mismatch between your Python, Apache, and mod_wsgi:
- Looking at your error log, your Python is 32-bit (
python37-32in the path), but the mod_wsgi package you downloaded is 64-bit (win_amd64). These two can’t work together.
Here’s how to fix this:
Step 1: Confirm Your Python Bitness
Run this command in Command Prompt to check if your Python is 32 or 64-bit:
python -c "import sys; print('64-bit' if sys.maxsize > 2**32 else '32-bit')"
You’ll likely see 32-bit based on your error logs.
Step 2: Get the Correct mod_wsgi Wheel
Download the 32-bit version of the mod_wsgi wheel that matches your Python 3.7 and Apache 2.4 (vc14). It should be named something like mod_wsgi-4.5.24+ap24vc14-cp37-cp37m-win32.whl.
Step 3: Install the Correct Wheel
Follow the same extraction/install steps as above with the 32-bit wheel, and this should resolve the linker error since all components will match in bitness.
3. Quick Post-Install Verification
Once mod_wsgi installs successfully, run this command to generate the Apache module configuration:
mod_wsgi-express module-config
Copy the three lines of output (they’ll look like LoadModule, WSGIPythonHome, etc.) and add them to your Apache httpd.conf file. Then you can proceed to configure your Django project with Apache.
内容的提问来源于stack exchange,提问作者I'm a IT Dumb Head

