简体   繁体   English

需要帮助安装 Anaconda 和 Spyder

[英]Need help installing Anaconda and Spyder

so i'm having some bad issues with my conda installation.所以我的 conda 安装有一些不好的问题。 I'm running this on MacOS Monterey 12.4我在 MacOS Monterey 12.4 上运行它

I installed the latest version "Anaconda3-2022.05-MacOSX-x86_64.sh" I then installed an env for spyder.我安装了最新版本的“Anaconda3-2022.05-MacOSX-x86_64.sh”,然后为 spyder 安装了一个环境。

conda create -n spyder spyder

Everything seems to go ok, however everytime I attempt to run my code I get a spyder internal problem.一切似乎都很好,但是每次我尝试运行我的代码时,我都会遇到一个 spyder 内部问题。

Traceback (most recent call last):
  File "/Users/person.blank/anaconda3/envs/spyder/lib/python3.9/site-packages/qtconsole/base_frontend_mixin.py", line 138, in _dispatch
    handler(msg)
  File "/Users/person.blank/anaconda3/envs/spyder/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/widgets/debugging.py", line 278, in _handle_input_request
    return super(DebuggingWidget, self)._handle_input_request(msg)
  File "/Users/person.blank/anaconda3/envs/spyder/lib/python3.9/site-packages/qtconsole/frontend_widget.py", line 512, in _handle_input_request
    self._readline(msg['content']['prompt'], callback=callback, password=msg['content']['password'])
  File "/Users/person.blank/anaconda3/envs/spyder/lib/python3.9/site-packages/qtconsole/console_widget.py", line 2422, in _readline
    self._show_prompt(prompt, newline=False, separator=False)
TypeError: _show_prompt() got an unexpected keyword argument 'separator'

After this I removed and recreated the spyder env with:-在此之后,我删除并重新创建了 spyder 环境: -

conda create -n spyder -c conda-forge spyder

When I attempt to launch spyder it never connects to the kernel in IPython Console.当我尝试启动 spyder 时,它永远不会连接到 IPython 控制台中的内核。 So at this point I tried doing another:所以此时我尝试做另一个:

conda update --all

This updates the files, but when I launch spyder again I get a missing dependencies.这会更新文件,但是当我再次启动 spyder 时,我得到了缺少的依赖项。

Mandatory:强制的:

qtpy >=2.1.0 : 2.0.1 (NOK) qtpy >=2.1.0 : 2.0.1 (NOK)

Should it be this difficult to get anaconda and spyder working?让 anaconda 和 spyder 工作就这么难吗? I've always had it working without issue in the past.过去我一直让它正常工作。 Anyway any help in solving this would be gratefully appreciated.无论如何,任何帮助解决这个问题都将不胜感激。

So after research this extensively I thought I would provide the solution that ultimately worked.因此,经过广泛研究后,我认为我会提供最终有效的解决方案。

To resolve this issue you need to create an env from the conda-forge repo, in order to get the compatible versions of spyder and the spyder kernels.要解决此问题,您需要从 conda-forge 存储库创建一个环境,以便获得 spyder 和 spyder 内核的兼容版本。

conda create -n spyder-cf -c conda-forge spyder jupyter_client=7.3.1

So just breaking this down for completeness:-因此,为了完整起见,只需将其分解:-

Creates an env with the name spyder-cf创建一个名为 spyder-cf 的环境

create -n spyder-cf

Use the conda-forge repo使用 conda-forge 存储库

-c conda-forge

Install spyder and the jupyter client from conda-forge从 conda-forge 安装 spyder 和 jupyter 客户端

spyder jupyter_client=7.3.1

Once done you can activate the spyder-cf env and run spyder.完成后,您可以激活 spyder-cf 环境并运行 spyder。 However if you wish to use alternative env's then simply create the env you like and open it from spyder.但是,如果您希望使用替代环境,那么只需创建您喜欢的环境并从 spyder 打开它。 For example, if I want a python 3.10 env I would do the following:例如,如果我想要一个 python 3.10 环境,我会执行以下操作:

conda create -n env310 -c conda-forge python=3.10 spyder-kernels

It's important to install this from conda-forge so that you get the correct spyder kernel headers.从 conda-forge 安装它很重要,这样您才能获得正确的 spyder 内核头文件。

Change to the spyder-cf env更改为 spyder-cf 环境

activate spyder-cf

Activate your python 3.10 env激活你的 python 3.10 环境

spyder activate env310

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM