【问题标题】:Python Spyder resetPython Spyder 重置
【发布时间】:2012-04-02 13:55:14
【问题描述】:

我使用的是 Spyder 附带的 python(x,y)。昨天,Spyder 崩溃了,我不知道如何修复它。我卸载了 python(x,y) 并重新安装,仍然是同样的问题。

如果我尝试打开 Spyder,我会收到以下消息:

Spyder crashed during last session

If Spyder does not start at all and before submitting a bug report, please try to reset setting to defaults by running Spyder with the command line option '--reset:

python spyder --reset

当然,我尝试执行上述操作,但我的路径中似乎没有 Spyder。当我尝试放

python spyder --reset

在我的命令提示符窗口中,我收到以下错误消息:

python: can't open file 'spyder': [Errno 2] No such file or directory

我尝试将 spyder 添加到路径中,但都失败了。我应该如何将 Spyder 添加到路径中?

我在 32 位系统上使用 Windows Vista。

我的 Spyder 崩溃报告如下所示:

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\spyderlib\spyder.py", line 1547, in main
    mainwindow = run_spyder(app, options)
  File "C:\Python27\lib\site-packages\spyderlib\spyder.py", line 1472, in run_spyder
    main.setup()
  File "C:\Python27\lib\site-packages\spyderlib\spyder.py", line 555, in setup
    multithreaded=self.multithreaded)
  File "C:\Python27\lib\site-packages\spyderlib\plugins\console.py", line 54, in __init__
    light_background=light_background)
  File "C:\Python27\lib\site-packages\spyderlib\widgets\internalshell.py", line 101, in __init__
    debug, profile)
  File "C:\Python27\lib\site-packages\spyderlib\widgets\shell.py", line 698, in __init__
    ShellBaseWidget.__init__(self, parent, history_filename, debug, profile)
  File "C:\Python27\lib\site-packages\spyderlib\widgets\shell.py", line 61, in __init__
    self.history = self.load_history()
  File "C:\Python27\lib\site-packages\spyderlib\widgets\shell.py", line 500, in load_history
    if rawhistory[1] != self.INITHISTORY[1]:
IndexError: list index out of range

我对这些东西很糟糕,所以我可能会遗漏一些完全明显的东西或做一些非常愚蠢的事情。

我想知道是否有其他人遇到过类似的问题,或者可以就该做什么以及如何做这个“重置”的事情提出建议,或者其他建议。

提前致谢

标签: python spyder


【解决方案1】:

python 不会在 PATH 中搜索 spyder,例如:

c:\some\dir> python some_file

这里python 尝试读取c:\some\dir\some_file 文件,即它在当前目录中查找some_file 文件。

c:\some\dir> python another_dir\some_file

这里python 尝试读取c:\some\dir\another_dir\some_file 文件,即它在another_dir 目录中查找some_file 文件。

c:\some\dir> python C:\path\to\some_file

这里python 尝试读取C:\path\to\some_file 文件,即它在C:\path\to 目录中查找。


如果文档显示运行:python spyder --reset,则假定您位于 spyder 脚本所在的目录中。它既可以从源代码签出scripts 目录(如果您想在不安装的情况下运行它)也可以从安装将脚本放入的任何目录中运行。

安装过程应创建spyderspyder.bat 文件。如果 spyder.bat 在您的 PATH 中,那么您可以将其运行为:

c:\any\dir> spyder

所以你可以试试python spyder --reset,而不是:

c:\any\dir> spyder --reset

traceback显示第一个执行的函数是spyderlib.spyder.main()source code for the spyder script 确认,可以运行:

python -c "from spyderlib.spyder import main; main()" --reset

【讨论】:

  • 它解决了我刚刚遇到的同样问题(谢谢)。顺便说一句:重置当然会删除您的个人设置 wrt spyder。您可以在重置之前查看您的 .spyder 目录(主文件夹附近的某个位置)以尝试保存重置后的一些设置。
【解决方案2】:

别担心,重置 spyder 很容易。对于 Windows 10 用户,您都需要在“Cortana”中输入“spyder”,然后您可以在应用程序类别中看到“重置 spyder 设置”之类的内容,只需单击它,就会打开一些黑屏,您的问题就会得到解决。现在你可以打开你的spyder了。

【讨论】:

  • Hey@Hiten 欢迎来到 stack-overflow 为您在旧帖子中提供的新帖子提供答案,请避免此问题,并且该帖子已被接受。
  • @Hiten,感谢您的回答,它立即解决了我的问题!
  • @Hiten 感谢您的发帖。我正在尝试上述所有事情,但这对我根本不起作用。我看到了你的答案,是的,它起作用了。再次感谢您
【解决方案3】:

我在windows中遇到了这个问题,通过更新spyder解决了

pip install -U spyder

【讨论】:

  • 在 Anaconda 中,使用:conda install -c anaconda spyder
【解决方案4】:

大部分用户的 spyder 设置都在用户文件夹 .Spyder 文件名中。通过删除它。您将能够重新启动 IDE 并创建一个新的 .Spyder 目录

【讨论】:

    【解决方案5】:

    我正在使用 conda 虚拟环境,如果你运行 python spyder --reset it 它将输出相同的错误消息。但是,与上述不同的是,无需卸载 anaconda 或查找任何文件。

    只需像往常一样激活您的虚拟环境并编写(其中不需要“python”):

    conda activate [name of your virtual env]
    spyder --reset
    

    这对我有用。

    【讨论】:

      【解决方案6】:

      对于winpython的初学者,我也遇到过 spyder/spyder-reset not started 的问题。最后这就是它的开始:

      打开的命令行转到:

      D:\manas\mak\crap\WinPython-64bit-3.4.4.2\scripts

      输入spyder.bat

      然后打开了 spyder。

      当单击 spyder 图标并阻止它加载时,可能环境变量卡在 .exe 上。

      【讨论】:

        【解决方案7】:

        根据我的经验最好的解决方案:先卸载spyder,删除conda > lib > site-packages > ..下的所有spyder文件

        1. pip install ipython
        
        2. pip install spyder
        
        3. spyder --reset
        

        【讨论】:

          【解决方案8】:

          我遇到了类似的问题。我安装了两个 Python27 —— Ananaconda 发行版和另一个。在我的搜索路径中,Python27 文件夹出现在 Anaconda 文件夹之前,尽管 Spyder 是通过 Anaconda 可执行文件执行的。

          事实证明,将 Anaconda 分发文件夹首先放在 PYTHONPATH 中解决了这个问题。

          一个更简单的解决方案——尽可能避免多次安装 Python27。

          【讨论】:

            【解决方案9】:

            我尝试了关于“python -c”的方法 from spyderlib.spyder import main; main()" --reset",但是我好像没有spyderlib.spyder。然后,我通过安装另一个版本的spyder来解决这个问题(如果你使用它可以从anaconda找到),你可以运行:

            conda install -c anaconda spyder-app=2.3.8 
            

            它有效。

            【讨论】:

            • 这将降级所有 anaconda 而不仅仅是 spyder
            • 它可能会降级依赖,但不应该降级 anaconda 的其余部分,除非有错误......
            【解决方案10】:

            根据上一个答案搜索 spyder.bat,并在更改为该目录后 - 运行 python spyder --reset 命令。

            C:\WinPython-32bit-2.7.3.3\python-2.7.3>cd scripts
            C:\WinPython-32bit-2.7.3.3\python-2.7.3\Scripts>python spyder --reset
            

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 2014-01-22
              • 2014-08-29
              • 2015-07-14
              • 2016-11-18
              • 2019-08-03
              • 2017-12-09
              • 2013-04-13
              相关资源
              最近更新 更多