如何使用带有 Anaconda 的 Python 3.7 运行 Spyder
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/51139232/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to run Spyder with Python 3.7 with Anaconda
提问by Kev1n91
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.
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
.
但是,在此环境中启动 Spyder 会将其退回到 Python 3.6。我尝试直接在Tools -> Settings
Spyder 中指定 python.exe(对于 3.7 版),但是在重新启动后,Spyder 内核无法启动,并且会显示它们需要软件包:ipykernel
和cloudpickle
.
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
回答by James
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.
当您spyder
从 CMD/终端运行时,您的操作系统会尝试在系统的 PATH 中查找 spyder 可执行文件。在这种情况下,它将默认返回到运行 Python 3.6 的基本环境的 spyder 版本。
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).
到目前为止我发现的最好方法是将 spyder 安装到新环境中;激活环境,然后运行 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. Currently that is not available (as of 2 July 2018), but it should not be too long coming.
但是,这需要spyder的版本支持python 3.7。目前不可用(截至 2018 年 7 月 2 日),但应该不会太久。
EDIT:Spyder for Python 3.7 is available.
编辑:适用于 Python 3.7 的 Spyder 可用。