我使用的是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。
My Spyder Crash报告如下:
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
我对这些东西很糟糕,所以我可能会遗漏一些完全明显的东西或做一些非常愚蠢的事情。
我想知道是否有其他人遇到过类似的问题,或者只是就如何做,以及如何做“重置”事情或其他建议提出建议。
提前感谢
答案 0 :(得分:17)
python
不会在spyder
中搜索PATH
,例如:
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
目录(如果你想在没有安装的情况下运行它),也可以从安装程序放入脚本的目录中运行。
安装过程应创建spyder
或spyder.bat
个文件。如果spyder.bat
中有PATH
,那么您可以将其作为:
c:\any\dir> spyder
所以你可以尝试代替python spyder --reset
:
c:\any\dir> spyder --reset
回溯显示第一个执行的函数是spyderlib.spyder.main()
,
source code for the spyder
script确认了这一点,因此您可以运行:
python -c "from spyderlib.spyder import main; main()" --reset
答案 1 :(得分:9)
答案 2 :(得分:3)
我在Windows中遇到此问题,并通过更新spyder
解决了这个问题pip install -U spyder
答案 3 :(得分:2)
大多数用户的spyder设置都在用户文件夹.Spyder文件名中。删除它。您将能够重新启动IDE并创建一个新的.Spyder目录
答案 4 :(得分:2)
我正在使用conda虚拟环境,如果您运行
python spyder --reset it
将输出相同的错误消息。但是,与上述不同,无需卸载anaconda或查找任何文件。
只需像平常一样激活并编写虚拟环境(在那里不需要'python'):
conda activate [name of your virtual env]
spyder --reset
这对我有用。
答案 5 :(得分:1)
对于winpython的初学者,我也遇到了spyder / spyder-reset无法启动的问题。最后这就是它的开始:
打开命令行转到:
D:\manas\mak\crap\WinPython-64bit-3.4.4.2\scripts
输入spyder.bat
那打开了spyder。
当点击spyder图标并阻止加载时,环境变量可能会停留在.exe上。
答案 6 :(得分:1)
根据我的经验提供的最佳解决方案:首先卸载spyder,删除conda > lib > site-packages > ..
下的所有spyder文件
1. pip install ipython
2. pip install spyder
3. spyder --reset
答案 7 :(得分:0)
搜索spyder.bat,根据上一个答案,并在更改为directoy后 - 运行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
答案 8 :(得分:0)
我有类似的问题。我有两个安装Python27 --- Ananaconda发行版和另一个。 Python27文件夹出现在我的搜索路径中的Anaconda之前,尽管Spyder是通过Anaconda可执行文件执行的。
事实证明,在PYTHONPATH中首先制作Anaconda分发文件夹解决了这个问题。
更简单的解决方案 - 尽可能避免多次安装Python27。
答案 9 :(得分:0)
我从spyderlib.spyder import main尝试了关于" python -c"的方法;主()" --reset"但似乎我没有spyderlib.spyder。然后,我通过安装另一个版本的spyder来解决这个问题(如果你使用它你可以从anaconda找到),你可以运行:
conda install -c anaconda spyder-app=2.3.8
它有效。