且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

内置函数不能与Spyder一起使用

更新时间:2023-01-13 11:13:32

这是Spyder附带的一个iPython头像。当从几秒后复制/粘贴随机代码片段来测试以发现非常奇怪的行为时,我已经陷入了这种情况 - 在iPython控制台中定义的变量也将无限期地放在脚本的全局名称空间中。

This is a bit of an iPython headshot that comes with Spyder. I've fallen foul of this when copy/pasting random bits of code from SO to test only to find really odd behaviour several days later - variables defined in the iPython console will also be in the script's global namespace indefinitely.

您可以执行以下两项操作:

There's two things you can do:


  1. 内核硬启动( ctrl +

  2. 后续这个功能请求线程,现在可以在每次运行脚本时自动清除名称空间。

  1. A hard restart of the Kernel (ctrl + .)
  2. Follow up on this feature request thread where it's now possible to clear the namespace automatically every time you run a script.