You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Spyder(Python 3.8)环境使用报错求助:已安装spyder-kernels仍无法创建控制台

Fixing Spyder-Kernels Version Mismatch in Custom Anaconda Environments

Hey there! Let’s work through this frustrating issue together—it’s super common when setting up a new Anaconda environment for Spyder, and we can resolve it with a few targeted steps.

1. Install the exact required version of spyder-kernels in your target environment

The error specifies you need a version >=1.9.2 and <1.10.0, so installing the latest generic version won’t cut it. Here’s how to do it correctly:

  • First, make sure you’ve activated the correct environment (not your base environment!) in your terminal:
    conda activate your-new-environment-name
    
  • Then install the compatible range using conda (preferred for Anaconda environments):
    conda install spyder-kernels=1.9.*
    
    Or if you prefer pip:
    pip install spyder-kernels==1.9.5
    
    (1.9.5 is a stable release within the required range—any version between 1.9.2 and 1.9.9 will work.)

2. Verify Spyder is pointing to the correct environment’s interpreter

It’s easy to accidentally leave Spyder using your base environment even after setting up the new one. Let’s double-check:

  • Open Spyder, go to Tools > Preferences > Python interpreter
  • Select the option Use the following interpreter
  • Browse to the Python executable in your new environment:
    • On Windows: C:\Users\[YourUsername]\anaconda3\envs\[YourEnvName]\python.exe
    • On macOS/Linux: ~/anaconda3/envs/[YourEnvName]/bin/python
  • Click Apply and restart Spyder completely.

3. Clear Spyder’s kernel cache (if the above steps don’t work)

Sometimes Spyder caches old kernel information, so we need to reset it:

  • Close Spyder entirely
  • In your activated environment’s terminal, run this command to manually test the kernel:
    python -m spyder_kernels.console
    
    If this runs without errors, the kernel is installed correctly—Spyder just needs to pick it up.
  • Delete Spyder’s configuration cache folder:
    • Windows: Delete %USERPROFILE%\.spyder-py3
    • macOS/Linux: Delete ~/.spyder-py3
  • Restart Spyder—it will rebuild the cache and detect your new environment’s kernel.

4. Confirm Python-Spyder compatibility

Since you’re using Python 3.8, ensure your Spyder version supports it: Spyder 4.x has full support for Python 3.8, while Spyder 5.x also works but might have minor quirks. If you’re running an older Spyder version, update it (in your base environment, run conda update spyder) to ensure compatibility.


内容的提问来源于stack exchange,提问作者nuria.mc

火山引擎 最新活动