【发布时间】:2020-08-20 00:55:19
【问题描述】:
我有 python 2.7 作为我的基础。我用 python 3.7 创建了一个环境。
conda create -n py3 python=3.7
在 Anaconda 提示中。 现在我已经激活了我的 python 3.7。
conda activate py3 or activate py3
现在我已经检查了我的 python 版本
python --version
它的状态为 python 3.7.7
conda run spyder
现在 spyder 已启动,但仍在 python 2.7 中打开。
我想使用 PyTorch 但也需要 python 2.7,而 PyTorch 不适合使用 python 2.7。我需要在 python 3.7 中使用 PyTorch,我也需要在单个系统中使用 python 2.7。我该怎么做?环境设置没问题,但启动 spyder 是我真正的问题。
【问题讨论】:
-
我不是专家,但如果这听起来像你需要的东西:
Provides Jupyter kernels for use with the consoles of Spyder, the Scientific Python Development Environment. These can launched either through Spyder itself or in an independent Python session, and allow for interactive or file-based execution of Python code in different environments, all inside the IDE. For more on Spyder, visit https://www.spyder-ide.org/看看 spyder-kernels。 -
激活 python 3.7 后,我已经安装了 Pytorch,但是当我打开 Jupyter Notebook 或 Spyder 并尝试使用 Pytorch(import torch)编写代码时,它会给出“没有名为 Pytorch 的模块”的错误。我认为我的问题出在 python 版本上,因为 python 2.7 不支持 Pytorch。无论我的 py3 环境如何,我的 spyder 或 Jupiter 笔记本都使用 python 2.7 打开。
标签: python-3.x python-2.7 anaconda spyder