Windows10与Raspbian系统Spyder3遇ModuleNotFoundError: No module named 'deap'求助
Hey there, I’ve dealt with this exact kind of package environment mismatch before, so let’s walk through how to get DEAP working in your Spyder3 instances on both Windows 10 and Raspbian:
1. Ensure DEAP is installed to Spyder’s active Python environment
The most common issue here is that pip install deap is installing the package to a different Python interpreter than the one Spyder is actually using. Here’s how to align them:
- Open Spyder3, go to the IPython Console, and run this command:
This will output the full path to the Python interpreter Spyder relies on.import sys; print(sys.executable) - Use that path to install DEAP directly to this environment:
- Windows 10: Open Command Prompt/PowerShell and run:
(Replace the path with what you copied from the console)"C:\Path\From\Spyder\python.exe" -m pip install deap - Raspbian: Open a terminal and run:
/path/from/spyder/python -m pip install deap
- Windows 10: Open Command Prompt/PowerShell and run:
2. Use Spyder’s built-in package manager for installation
Spyder has a dedicated tool to manage packages tied to its working environment:
- Go to
Tools > Preferences > Python interpreterin Spyder’s top menu. - Confirm the listed interpreter matches the one you identified in step 1. If not, select the correct one from the dropdown.
- Click the
Install packagesbutton, search fordeap, and install it directly from here. This guarantees the package lands in Spyder’s active environment.
3. Restart Spyder completely
I can’t stress this enough—after installing the package, close Spyder entirely (don’t just minimize it) and reopen it. Sometimes Spyder caches the list of available modules and needs a fresh start to recognize new installs.
4. Verify the installation outside Spyder
To rule out Spyder-specific quirks:
- Open a terminal/command prompt, launch the same Python interpreter path you got from Spyder, then run:
import deap; print(deap.__version__)
If this works and prints the DEAP version, the problem is definitely that Spyder wasn’t using the right environment. Double-check step 2 to ensure you’ve switched to the correct interpreter in Spyder’s settings.
内容的提问来源于stack exchange,提问作者cupofcalculus

