类型错误:runfile() 获得意外的关键字参数“current_namespace”

LEE*_*HAN 13 python debugging

我在尝试调试 python 脚本时收到错误消息:

debugfile('C:/Users/Wei-shan/Desktop/pythonScripts/simple pendulum.py', wdir='C:/Users/Wei-shan/Desktop/pythonScripts', current_namespace=True)
Traceback (most recent call last):

  File "C:\Users\Wei-shan\AppData\Local\Temp/ipykernel_19384/837447315.py", line 1, in <module>
    debugfile('C:/Users/Wei-shan/Desktop/pythonScripts/simple pendulum.py', wdir='C:/Users/Wei-shan/Desktop/pythonScripts', current_namespace=True)

  File "D:\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 589, in debugfile
    enter_debugger(

  File "D:\anaconda3\lib\site-packages\spyder_kernels\customize\spyderpdb.py", line 773, in enter_debugger
    debugger.run(code)

  File "D:\anaconda3\lib\site-packages\spyder_kernels\customize\spyderpdb.py", line 716, in run
    super(SpyderPdb, self).run(cmd, globals, locals)

  File "D:\anaconda3\lib\bdb.py", line 580, in run
    exec(cmd, globals, locals)

  File "<string>", line 1, in <module>

TypeError: runfile() got an unexpected keyword argument 'current_namespace'

Run Code Online (Sandbox Code Playgroud)

有什么建议么?非常感谢

Col*_*lin 19

这将在 Spyder 5.1.2 中修复。同时,将ipykernel环境中的包降级到6.2.0:

conda activate my_env
conda install ipykernel=6.2.0
Run Code Online (Sandbox Code Playgroud)

您应该看到类似以下内容:

The following packages will be DOWNGRADED:

  ipykernel                            6.4.1-py37h06a4308_1 --> 6.2.0-py37h06a4308_1

Run Code Online (Sandbox Code Playgroud)

之后,重新启动spyder,应该就好了。


Luk*_*fer 2

对我来说,通过完全卸载并重新安装 Spyder 修复了该错误。看起来问题在于您的间谍内核版本已过时。前段时间这里发生了变化。也许是一个简单的

conda update --all
Run Code Online (Sandbox Code Playgroud)

足够。但我还没有测试过这个。