解决Spyder无法正确处理Tensorflow或者pytorch的spyder‑kernels问题

问题核心:python语言的版本不一致,一般3.8及以下没有太大问题
如何解决?出现下面问题怎么办?
The Python environment or installation whose interpreter is located at
F:\py\Anaconda3\envs\sdsd_torch\python.exe
doesn’t have the spyder‑kernels module or the right version of it installed (>= 2.2.1 and < 2.3.0). Without this module is not possible for Spyder to create a console for you.

You can install it by activating your environment (if necessary) and then running in a system terminal:
conda install spyder‑kernels=2.2
or
pip install spyder‑kernels==2.2.*

我以tensorflow为例:
(1)打开Powershell Prompt
conda env list
找到你环境的名字,这里我是tf2.6
(2)激活环境
conda activate tf2.6
(3)最关键的一步
conda install spyder
等于说重装一个以tensorflow的ipykernels作为spyder‑kernels,然后在你的菜单栏出现新的spyder选项,点击打开即可。(如果打开异常可以重启电脑)

你可能感兴趣的:(tensorflow,pytorch,python)