打开python shell报错了:Unknown option: --

用子龙的spacemacs配置,C-c C-p打开pythonshell 报这个错。昨天还好好的。 我用的是win10.。大神们讲解下怎么解决呗?

Unknown option: --
usage: c:\Users\xxxxx\AppData\Local\Programs\Python\Python36-32\python.exe [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

Process Python exited abnormally with code 2

SPC SPC输入customize-group,接着输入python回车,然后找到python shell interpreter args。然后改成-i,左键state然后选save for future session。

试试看吧,我windows上并没有装emacs。。。凭感觉这样应该能解决, good luck!

2 个赞

改成-i是可以了,但是保存后每次重启参数又变回去了。 我看到custom-set-variables里确实有

'(python-shell-interpreter-args “-i”)

怎么让这个参数启动的时候也生效?

我解决了,把参数写到 dotspacemacs-configuration-layers的python变量里就好了。多谢!

 (python :variables
         python-test-runner '(nose pytest)
         python-shell-interpreter-args "-i")

恩,你可以选择点击save for future session(在customize group里),也可以手动写到customize.el里面。这两种方法也都可行。