[英]Working with Spyder IDE and virtualenv. Changing interpreter but does not seem to update
[英]virtualenv IPython in Spyder not working
我已经在 Linux(确切地说是 Mint 17)上安装了 Spyder,并使用 ipython、numpy 等创建了一个科学的 virtualenv(sci)。这个想法是改变我的虚拟环境,用于 python 2/python 3,并且比安装更灵活整个 Anaconda / python(x,y)。 我现在在让 ipython 在 Spyder 中工作时遇到问题。
我去了
Tools->Preferences->Console->Advanced settings
使用以下 Python 解释器
/home/mike/envs/sci/bin/ipython
但这并没有启动 ipython。 它回应
...
Execute the given command[TerminalIPythonApp] CRITICAL | Bad config encountered during initialization:
[TerminalIPythonApp] CRITICAL | Unrecognized flag: '-u'
...
它也不会在控制台下显示“打开 IPython 控制台”。
我有什么想法吗?
干杯,迈克
在您的 virtualenv 中正确输入 Python 解释器的路径后(即/home/mike/envs/sci/bin/python
,而不是/home/mike/envs/sci/bin/ipython
),您只需要转到菜单
Consoles > Open an IPython console
并且,只要您在 virtualenv 中安装了 IPython 和 PyQt/PySide,就会使用您的 virtualenv 的 IPython 版本为您打开一个 IPython 控制台。
该过程在以下链接中进行了描述:
https://github.com/spyder-ide/spyder/wiki/Working-with-packages-and-environments-in-Spyder
建议使用 spyder-kernels 安装模块化方法:
source env/bin/activate
)pip install spyder-kernels==0.*
python -c "import sys; print(sys.executable)"
首选项 > Python 解释器 > 使用以下解释器
这应该有效,快乐编码!
上面的解决方案对我不起作用。 对我有用的是在文档中遵循本指南: https : //docs.spyder-ide.org/ipythonconsole.html#connect-to-an-external-kernel
1) 打开终端并激活您的 virtualenv 2) 仍在终端中,运行命令: python -m spyder_kernels.console
,您将收到如下消息:
To connect another client to this kernel, use:
--existing kernel-28340.json
3) 要定位这个 json 文件位置,在 spyder 中运行它:
from jupyter_core import paths
paths.jupyter_runtime_dir()
对我来说是 c:\\Users[myuser]\\AppData\\Roaming\\jupyter\\runtime\\
4) 在 jupyter 中,从菜单中,单击“控制台 => 连接到现有内核”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.