How to run Spyder with Python 3.7 with Anaconda

走远了吗. 提交于 2019-12-09 12:24:28

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/51139232/how-to-run-spyder-with-python-3-7-with-anaconda

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!