Python Spyder reset

与世无争的帅哥 提交于 2019-11-27 13:48:57

问题


I was using python(x,y), which came with Spyder. Yesterday, Spyder crashed I can't figure it out how to fix it. I uninstalled python(x,y) and reinstalled, still the same problem.

If I try to open Spyder I get this message:

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

Of course, I tried to do the above, but it doesn't seem like I have Spyder in my path. When I try to put

python spyder --reset

in my command prompt window, I get this error message:

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

I made some attempts of trying to add spyder to path, but they all failed. How should I go about adding Spyder to path?

I am using Windows Vista on a 32 bit system.

My Spyder Crash report looks like this:

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

I am terrible with this stuff, so I might be missing something completely obvious or doing something really stupid.

I am wondering if anyone else ran into a similar problem, or can just give suggestions on what to do, and how to do this "reset" thing, or maybe other advice.

Thank You in Advance


回答1:


python doesn't search spyder in the PATH e.g.:

c:\some\dir> python some_file

Here python tries to read c:\some\dir\some_file file i.e., it looks in the current directory for some_file file.

c:\some\dir> python another_dir\some_file

Here python tries to read c:\some\dir\another_dir\some_file file i.e., it looks in the another_dir directory for some_file file.

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

Here python tries to read C:\path\to\some_file file i.e., it looks in the C:\path\to directory.


If documentation says run: python spyder --reset it assumes that you're in the directory where spyder script lives. It works both from the source checkout scripts directory (if you'd like to run it without installation) and from whatever directory the installation puts scripts in.

Installation process should create spyder or spyder.bat files. If spyder.bat in your PATH then you could run it as:

c:\any\dir> spyder

So instead of python spyder --reset you could try:

c:\any\dir> spyder --reset

The traceback shows that the first executed function is spyderlib.spyder.main(), source code for the spyder script confirms it, so you can run:

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



回答2:


don't worry, it is very easy to reset the spyder. for windows 10 users, you all need to type 'spyder' in 'Cortana' then you can see in apps category something like 'reset spyder setting' just click on that and some black screen will open and your problem will be solved. now you can open your spyder.




回答3:


I have this problem in windows and it resolved by updating the spyder

pip install -U spyder



回答4:


Most of the users' spyder settings are in the user folder .Spyder file name.By deleting it.You will be able to restart the IDE and a new .Spyder directory would be created




回答5:


For starters in winpython, I too faced this problem of spyder/spyder-reset not starting . And finally this is how it started :

opened command line went to :

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

typed in spyder.bat

And that opened spyder .

Perhaps the environment variable is stuck at .exe when clicking on the spyder icon and preventing it to load.




回答6:


Best solution as per my experience: uninstall spyder first, delete all the spyder files under conda > lib > site-packages > ..

1. pip install ipython

2. pip install spyder

3. spyder --reset



回答7:


Searched for spyder.bat, per prev answer, and after changing to that directoy - ran the python spyder --reset command.

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



回答8:


I had a similar problem. I had both two installations of Python27---the Ananaconda distribution and the other. Python27 folders appeared before the Anaconda ones in my search path, although Spyder was executed through the Anaconda executable.

It turned out that making the Anaconda distribution folders first in the PYTHONPATH solved the problem.

An easier solution--avoid multiple installations of Python27 if possible.




回答9:


I tried the method about "python -c "from spyderlib.spyder import main; main()" --reset",but it seems that I don't have the spyderlib.spyder.Then,I solve this problem through install another version of spyder(you can find from anaconda if you use it),you can run:

conda install -c anaconda spyder-app=2.3.8 

and it works.



来源:https://stackoverflow.com/questions/9747158/python-spyder-reset

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!