我在使用 Spyder(Windows 10 中)
时遇到此问题。当我尝试在 spyder
控制台上执行任何操作(甚至像 1+1 这样简单的操作)时,我会在内部控制台选项卡中收到以下错误消息:
(任何帮助将不胜感激)
Traceback (most recent call last): <br> <br>
File "C:\Users\ JohnDoe \Anaconda2\lib\site-packages\qtconsole\base_frontend_mixin.py", line 163, in _dispatch<br><br>
Traceback (most recent call last):<br><br>
File "C:\Users\ JohnDoe \Anaconda2\lib\site-packages\qtconsole\base_frontend_mixin.py", line 163, in _dispatch<br><br>
handler(msg)<br><br>
File "C:\Users\JohnDoe\Anaconda2\lib\site-packages\spyder\widgets\ipythonconsole\namespacebrowser.py", line 188, in _handle_execute_reply<br><br>
self.handle_exec_method(msg)<br><br>
File "C:\Users\ JohnDoe\Anaconda2\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 225, in handle_exec_method<br><br>
properties = ast.literal_eval(data['text/plain'])<br><br>
KeyError: 'text/plain'<br><br>
handler(msg)<br><br>
File "C:\Users\ JohnDoe\Anaconda2\lib\site-packages\spyder\widgets\ipythonconsole\namespacebrowser.py", line 188, in _handle_execute_reply<br><br>
self.handle_exec_method(msg)<br><br>
File "C:\Users\ JohnDoe\Anaconda2\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 222, in handle_exec_method<br><br>
view = ast.literal_eval(data['text/plain'])<br><br>
KeyError: 'text/plain'
最佳答案
当您像 Carlos mentioned 一样安装 Spyder 3 时,问题就得到解决
This error was fixed in Spyder 3.0.2. Please update to that version.
但是,它实际上不会影响我的代码或运行时间。唯一的缺点是您无法在显示此错误的机器上测试您的代码。
关于python - 打印时 Spyder 控制台出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40434824/