Windows环境下Python 3.7.0a2安装Pillow失败求助
Hey there, I’ve run into this exact problem before on Windows with Python 3.7—installing Pillow via pip fails because it needs system-level build tools that aren’t included by default. Let’s walk through the easiest fixes to get you back to migrating your Django project:
1. Use a Pre-compiled Pillow Wheel (Quickest Fix)
Instead of letting pip try to build Pillow from source (which is causing that traceback), grab a pre-built wheel file tailored to your setup:
- First, check if your Python is 32-bit or 64-bit: open Command Prompt and run
python -c "import sys; print(sys.maxsize > 2**32)"—if it returnsTrue, you’re on 64-bit;Falsemeans 32-bit. - Find a Pillow wheel that matches Python 3.7 and your system architecture. Look for filenames like
Pillow-8.4.0-cp37-cp37m-win_amd64.whl(64-bit) orPillow-8.4.0-cp37-cp37m-win32.whl(32-bit). - Download that wheel file to a folder you can easily access.
- Navigate to that folder in Command Prompt, then run:
For example:pip install [name-of-your-downloaded-wheel-file].whlpip install Pillow-8.4.0-cp37-cp37m-win_amd64.whl
2. Install Required Build Tools (If You Want to Compile Locally)
If you’d rather build Pillow from source, you need to install Microsoft’s C++ build tools:
- Install the Microsoft Visual C++ Build Tools 2017 (make sure to check the "Desktop development with C++" workload when setting it up—this includes the compilers pip needs).
- Restart your Command Prompt after installation, then run
pip install Pillowagain. This time, pip should have all the tools it needs to compile Pillow successfully.
3. Confirm It Worked & Run Migrations
Once Pillow is installed, verify it’s working by running:
python -c "import PIL; print(PIL.__version__)"
If you see a version number (like 8.4.0) without errors, head back to your Django project folder and re-run the migrations:
python manage.py migrate
That should resolve the fields.E210 error you got earlier.
Why This Happens
Python 3.7 on Windows doesn’t come with the C++ compilers required to build Pillow from source. Pre-built wheels skip the compilation step entirely, while installing the build tools gives pip the necessary environment to compile the package locally.
内容的提问来源于stack exchange,提问作者Vīkãs Vískíñg

