如何使用 Python 3.7 和 Anaconda 运行 Spyder

2024-03-09

我已经在 Windows 10 计算机上安装了 Anaconda,该计算机附带了 Spyder 和 Python 3.6,但我希望升级到 Python 3.7

使用 Python 3.7 创建 Anaconda 环境很容易,只需使用:

conda create --name py37 python=3.7

or:

conda create --name py370 python=3.7.0 --channel conda-forge

然而,在此环境中启动 Spyder 会将其返回到 Python 3.6。 我尝试直接在中指定 python.exe (对于版本 3.7)Tools -> SettingsSpyder,但是重新启动后,Spyder 内核无法启动,并且会显示它们需要这些软件包:ipykernel and cloudpickle .

当试图conda install他们在以下环境中出现:

The following packages will be DOWNGRADED:

    python:           3.7.0-hea74fb7_0      --> 3.6.6-hea74fb7_0

这会再次将 python 从 3.7 降级到 3.6。

我最后的尝试是使用命令:

conda install python==3.7

输出失败

Solving environment: failed

UnsatisfiableError: The following specifications were found to be in conflict:
  - python-dateutil -> python[version='>=2.7,<2.8.0a0']
  - python-dateutil -> six
  - python==3.7
Use "conda info <package>" to see the dependencies for each package.

问题不是如何将 Conda 升级到 Python 3.7,而是如何让 Spyder 在自己的环境中使用 Python 3.7


当你跑步时spyder从 CMD/终端,您的操作系统尝试在系统的 PATH 上查找间谍程序可执行文件。在这种情况下,它将默认返回到基本环境的spyder版本,该版本运行Python 3.6。

到目前为止我发现的最好的方法是在新环境中安装spyder;激活环境,然后运行spyder(这应该在本地环境中启动该版本)。

conda create --name py37 python=3.7  
conda install --name py37 spyder -c conda-forge
conda activate py37
spyder

不过,这需要spyder的版本支持python 3.7。目前尚不可用(截至 2018 年 7 月 2 日),但应该不会太久。

EDIT:适用于 Python 3.7 的 Spyder 现已推出。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用 Python 3.7 和 Anaconda 运行 Spyder 的相关文章

随机推荐