Python 2.7.13 Scrapy环境中ImportError: No module named wx问题求助
Fixing
ImportError: No module named wx in Python 2.7.13 Scrapy Environment Hey there, let's work through resolving that ImportError you're seeing when trying to import wx in your Python 2.7.13 Scrapy setup. Here are step-by-step solutions tailored to your environment:
1. Ensure you're in the correct Scrapy virtual environment
First things first—make sure you're working within the virtual environment where your Scrapy is installed. If you used virtualenv (the standard for Python 2.7):
- On Linux/macOS: Run
source path/to/your-scrapy-env/bin/activate - On Windows: Run
path\to\your-scrapy-env\Scripts\activate - Verify the environment is active by checking
python --version—it should show 2.7.13. This ensures any packages you install go into the right place, not your system-wide Python.
2. Install a Python 2.7-compatible wxPython version
wxPython 4.x and above only support Python 3+, so you need an older version that works with Python 2.7. The most stable option is wxPython 3.0.2.0:
- First, upgrade pip to a version that still supports Python 2.7 (newer pip versions dropped Python 2 support):
pip install pip==20.3.4 - Then install the compatible wxPython:
pip install wxPython==3.0.2.0
3. Verify the installation
Once the install finishes, test if wx is properly available:
- Launch the Python interpreter in your active environment:
python - Try importing wx:
import wx
If no error pops up, you're all set!
4. If using Anaconda for environment management
If your Scrapy environment is managed via Anaconda:
- Activate your Anaconda environment first, then run:
conda install -c conda-forge wxpython=3.0.2.0
内容的提问来源于stack exchange,提问作者rajeshbojja
相关产品推荐
相关产品推荐

