简体   繁体   English

如何使用带有Anaconda的Python 3.7运行Spyder

[英]How to run Spyder with Python 3.7 with Anaconda

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 我已经在配备Spyder和Python 3.6的Windows 10机器上安装了Anaconda,但我希望升级到Python 3.7

To create an Anaconda Environment with Python 3.7 is easy by using: 使用Python 3.7创建Anaconda环境非常简单:

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. 但是,在这种环境中启动Spyder会将其抛回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 . 我尝试直接在Tools -> Settings Spyder的Tools -> Settings中指定python.exe(对于版本3.7),但是在重新启动Spyder时,内核无法启动并且将显示他们需要包: ipykernelcloudpickle

When trying to conda install them in the environment the following appears: 尝试在环境中进行conda install时,会出现以下情况:

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. 哪个会再次将python从3.7降级到3.6。

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 问题不在于如何将Conda升级到Python 3.7,但我怎样才能让Spyder在自己的环境中使用Python 3.7

When you run spyder from the CMD/terminal, your operating system tries to find the spyder executable on your system's PATH. 当您从CMD /终端运行spyder ,您的操作系统会尝试在系统的PATH上找到spyder可执行文件。 In this case, it will default back to the base environment's version of spyder, which runs Python 3.6. 在这种情况下,它将默认返回到基本环境的spyder版本,它运行Python 3.6。

The best way I have found so far is to install spyder to the new environment; 到目前为止,我发现的最好方法是将spyder安装到新环境中; activate the environment, and then run spyder (which should fire up the version in the local environment). 激活环境,然后运行spyder(它应该启动本地环境中的版本)。

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. 但是,这需要spyder的版本来支持python 3.7。 Currently that is not available (as of 2 July 2018), but it should not be too long coming. 目前尚未提供(截至2018年7月2日),但不应该太长。

EDIT: Spyder for Python 3.7 is available. 编辑: Spyder for Python 3.7可用。

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

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