如何在Anaconda上使用Python 3.7运行Spyder [英] How to run Spyder with Python 3.7 with Anaconda

查看:1315
本文介绍了如何在Anaconda上使用Python 3.7运行Spyder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

使用以下命令轻松地使用Python 3.7创建Anaconda环境:

conda create --name py37 python=3.7

或:

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

但是,在此环境中启动Spyder会将其返回到Python 3.6. 我尝试直接在Spyder的Tools -> Settings中指定python.exe(针对3.7版),但是在重新启动Spyder内核后无法启动,并显示它们需要软件包:ipykernelcloudpickle.

在环境中尝试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一起使用

解决方案

从CMD/终端运行spyder时,操作系统将尝试在系统的PATH上找到spyder可执行文件.在这种情况下,它将默认返回运行Python 3.6的基本环境版本的spyder.

到目前为止,我发现最好的方法是将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日)尚不可用,但是应该不会太久.

可以使用适用于Python 3.7的Spyder.

I have installed Anaconda on a Windows 10 machine which comes with Spyder and Python 3.6 but I wish to upgrade to Python 3.7

To create an Anaconda Environment with Python 3.7 is easy by using:

conda create --name py37 python=3.7

or:

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

However starting Spyder in this environment will throw it back to Python 3.6. I tried specifing the python.exe (for version 3.7) directly in Tools -> Settings of Spyder, however upon restarting the Spyder Kernels can't be launched and will display that they need the packages: ipykernel and cloudpickle .

When trying to conda install them in the environment the following appears:

The following packages will be DOWNGRADED:

    python:           3.7.0-hea74fb7_0      --> 3.6.6-hea74fb7_0

Which would downgreade python from 3.7 to 3.6 again.

My final try was to use the command:

conda install python==3.7

which has failed with the output

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.

The question is not how to upgrade Conda to Python 3.7, but how can I get Spyder to work with Python 3.7 in its own environment

解决方案

When you run spyder from the CMD/terminal, your operating system tries to find the spyder executable on your system's PATH. In this case, it will default back to the base environment's version of spyder, which runs Python 3.6.

The best way I have found so far is to install spyder to the new environment; activate the environment, and then run spyder (which should fire up the version in the local environment).

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

However, this requires the version of spyder to support python 3.7. Currently that is not available (as of 2 July 2018), but it should not be too long coming.

EDIT: Spyder for Python 3.7 is available.

这篇关于如何在Anaconda上使用Python 3.7运行Spyder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆