我的ANACONDA里面启动spyder,提示启动ipython内核时候发生错误,错误代码如下:
Your Python environment or installation doesn't have the spyder‑kernels module or the right version of it installed (>= 2.1.0 and < 2.2.0). Without this module is not possible for Spyder to create a console for you.
You can install it by running in a system terminal:
conda install spyder‑kernels=2.1
or
pip install spyder‑kernels==2.1.*
然后我找了各种方式安装spyder‑kernels=2.1以后,提示如下:
C:\Users\88773>pip install -i https://pypi.tuna.tsinghua.edu.cn/simple spyder-kernels
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: spyder-kernels in c:\users\88773\anaconda3\lib\site-packages (2.1.3)
Requirement already satisfied: cloudpickle in c:\users\88773\anaconda3\lib\site-packages (from spyder-kernels) (2.0.0)
Requirement already satisfied: ipykernel>=5.3.0 in c:\users\88773\anaconda3\lib\site-packages (from spyder-kernels) (6.9.1)
Requirement already satisfied: ipython>=7.6.0 in c:\users\88773\anaconda3\lib\site-packages (from spyder-kernels) (8.2.0)
Requirement already satisfied: pyzmq>=17 in c:\users\88773\anaconda3\lib\site-packages (from spyder-kernels) (22.3.0)
**(以上我只黏贴了部分内容,参考第一行显示)
没法解决,还是报错**
** 然后我百度去增加了path环境设置,path里添加了如下:**
C:\Users\88773\anaconda3\Scripts
C:\Users\88773\anaconda3
C:\Users\88773\AppData\Local\Programs\Python\Python39\Scripts
C:\Users\88773\AppData\Local\Programs\Python\Python39
C:\Users\88773\anaconda3\condabin
C:\Users\88773\anaconda3\Scripts\Library\bin
依然报同样的错
** 困扰了两天了,找不到解决办法**
看你贴的安装命令没有指定版本啊,错误提示要求安装2.1版本的
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple spyder-kernels==2.1.*
上面提示了,你需要用conda install spyder‑kernels=2.1
或者pip install spyder‑kernels==2.1.*
这样指定版本来安装啊,你安装时没有指定版本,可能安装了不合适的版本。
而且需要在ANACONDA环境下去安装才行。
应该是之前安装过spyder 但是spyder的安装文件被删了 卸载后重新装一下 如果环境弄的太混乱 就卸载anconda 重新安装一遍
建议看下anaconda创建多个环境
在引入代码中配置一下就可以了
import os
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
https://github.com/spyder-ide/spyder/issues/5193
# 查看当前python版本
python -V
# 查看所有conda环境
conda info --envs
# 创建一个新的conda环境命名为 py370
conda create -n py370 python=3.7.0
conda info --envs
# 激活
conda activate py370
#取消激活
conda deactivate
在已经激活的虚拟环境中pip list 看一下已安装的包,缺哪个再pip装哪个