无法再为 Python 编程打开 Spyder IDE

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36337059/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 17:45:05  来源:igfitidea点击:

Can no Longer open Spyder IDE for Python Programming

pythonspyder

提问by Aniket Panjwani

I installed Python 3.4 on my Windows 7 laptop several months ago as part of Anaconda (https://www.continuum.io/downloads). My installation included the Spyder IDE, and I have successfully been using Spyder for Python programming.

几个月前,作为 Anaconda ( https://www.continuum.io/downloads) 的一部分,我在我的 Windows 7 笔记本电脑上安装了 Python 3.4 。我的安装包括 Spyder IDE,并且我已经成功地将 Spyder 用于 Python 编程。

However, since yesterday, I have been unable to open Spyder. I typically open Spyder via the Start Menu, but now, when I try to click on the Spyder icon in the Start Menu, I get no response. I then tried to go directly to the spyder.exe file in the Scripts folder in the directory where Anaconda is installed. When I clicked on this the first time, the following message flashed quickly and then disappeared:

但是,从昨天开始,我一直无法打开Spyder。我通常通过“开始”菜单打开 Spyder,但是现在,当我尝试单击“开始”菜单中的 Spyder 图标时,却没有任何响应。然后我尝试直接转到安装 Anaconda 的目录中 Scripts 文件夹中的 spyder.exe 文件。当我第一次点击这个时,下面的消息快速闪烁然后消失了:

Traceback (most recent call last):
  File "C:\Users\Aniket\Anaconda3\Scripts\spyder-script.py". line 2, in <module>
    start_app.main()
  File "C:\Users\Aniket\Anaconda3\lib\site-packages\spyderlib\start_app.py", line 114, in main
    from spyderlib import spyder
  File "C:\Users\Aniket\Anaconda3\lib\site-packages\spyderlib\spyder.py", line 100 in <module>
  File "C:\Users\Aniket\Anaconda3\lib\site-packages\spyderlib\qt\QtSvg.py", line 10 in <module>
    from PyQt4.QtSvg import * # analysis:ignore
ImportError:DLL load failed: The specified module could not be found

I double-clicked on Spyder.exe a second time, and this time, received the following message:

我第二次双击 Spyder.exe,这一次,收到以下消息:

kfile.py", line 146 in lock
    symlinke(str(os.getpid()), self.name)
  File "C:\Users\Aniket\Anaconda3\lib\site-packages\spyderlib\utils\external\lockfile.py", line 87, in symlink
    os.rmdir(newlinkname)
OSError: [WinError 145] The directory is not empty: 'C:\Users\Aniket\.spyder2-py3\spyder.lock.1459432906109.newlink'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Aniket\Anaconda3\Scripts\spyder-script.py". line 2, in <module>
    start_app.main()
  File "C:\Users\Aniket\Anaconda3\lib\site-packages\spyderlib\start_app.py", line 106, in main
    from spyderlib import spyder
  File "C:\Users\Aniket\Anaconda3\lib\site-packages\spyderlib\spyder.py", line 100 in <module>
  File "C:\Users\Aniket\Anaconda3\lib\site-packages\spyderlib\qt\QtSvg.py", line 10 in <module>
    from PyQt4.QtSvg import * # analysis:ignore
ImportError:DLL load failed: The specified module could not be found

Both of these messages flashed very quickly and then disappeared - I captured them by quickly pressing Print Screen when they appeared. It's not evident to me what the error messages imply, nor what would have caused this. It's possible that I closed Spyder while some function was running, or that Spyder crashed and caused some persistent error. Does anyone know how I can fix this?

这两条消息都非常迅速地闪烁然后消失了——当它们出现时,我通过快速按下 Print Screen 来捕捉它们。我不清楚错误消息的含义,也不清楚是什么导致了这种情况。有可能是我在某些功能运行时关闭了 Spyder,或者 Spyder 崩溃并导致一些持续性错误。有谁知道我该如何解决这个问题?

回答by ram

I had a similar problem of Spyder 2 not starting. My installation is part of Anaconda, on Win7 64-bit OS. I tried all the solutions outlined here and here, but they did not work for me. From the command line, I got the following error(s) when trying to reset spyder:

我遇到了 Spyder 2 无法启动的类似问题。我的安装是 Anaconda 的一部分,在 Win7 64 位操作系统上。我尝试了此处和此处列出的所有解决方案,但它们对我不起作用。在命令行中,尝试重置 spyder 时出现以下错误:

U:\>python -c "from spyderlib.spyder import main; main()" --reset
Traceback (most recent call last):
  File "C:\Temp\pApps\Anaconda3\lib\site-packages\spyderlib\qt\__init__.py", line 48, in <module> from PySide import __version__  # analysis:ignore
ImportError: No module named 'PySide'

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "C:\Temp\pApps\Anaconda3\lib\site-packages\spyderlib\requirements.py", line 40, in check_qt from spyderlib import qt File "C:\Temp\pApps\Anaconda3\lib\site-packages\spyderlib\qt\__init__.py", line 50, in <module>
    raise ImportError("Spyder requires PySide or PyQt to be installed")
ImportError: Spyder requires PySide or PyQt to be installed

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Temp\pApps\Anaconda3\lib\site-packages\spyderlib\spyder.py", line 48, in <module> requirements.check_qt()
  File "C:\Temp\pApps\Anaconda3\lib\site-packages\spyderlib\requirements.py", line 50, in check_qt % (qt_infos['pyqt']+qt_infos['pyside']))
  File "C:\Temp\pApps\Anaconda3\lib\site-packages\spyderlib\requirements.py", line 25, in show_warning
    raise RuntimeError(message)
RuntimeError: Please check Spyder installation requirements:
PyQt4 4.6+ (or PySide 1.2.0+) is required.

What surprised me was that spyder worked fine till yesterday, and I just did a full update yesterday as follows:

令我惊讶的是 spyder 一直工作到昨天,我昨天刚刚做了一个完整的更新如下:

conda update --all

So I again updated spyder today with the following:

所以我今天再次更新了spyder,内容如下:

conda update spyder

And the following package plan was presented to me: The following packages will be UPDATED:

并向我展示了以下套餐计划:以下套餐将被更新:

    spyder:     2.3.7-py35_3      None://None/<unknown> --> 2.3.8-py35_1
    spyder-app: 2.3.7-py35_0                            --> 2.3.8-py35_0

The following packages will be DOWNGRADED due to dependency conflicts:

    matplotlib: 1.5.3-np111py35_1                       --> 1.5.1-np111py35_0
    pyqt:       5.6.0-py35_0                            --> 4.11.4-py35_7
    qt:         5.6.0-vc14_0                            [vc14] --> 4.8.7-vc14_9
     [vc14]
    qtconsole:  4.2.1-py35_2                            --> 4.2.1-py35_0

After the update, spyder works fine now. In essence, my problem was due to dependency conflicts.

更新后,spyder 现在可以正常工作了。本质上,我的问题是由于依赖冲突。

回答by SarahD

I know this is an old thread but having just had the same problem an answer that worked for me from https://github.com/spyder-ide/spyder/issues/3005

我知道这是一个旧线程,但刚刚遇到了同样的问题,一个对我有用的答案来自https://github.com/spyder-ide/spyder/issues/3005

My problem appeared to be that the status of spyder was still running so wouldn't open. To fix this you need to look for a directory called .spyder2 in your Users\ directory, then find a file called spyder.lock and remove it.

我的问题似乎是 spyder 的状态仍在运行,因此无法打开。要解决此问题,您需要在 Users\ 目录中查找名为 .spyder2 的目录,然后找到名为 spyder.lock 的文件并将其删除。

回答by Jim

Had the same exact problem as you a few days ago and reinstalling won't work so I went to:

几天前和你有同样的问题,重新安装不起作用,所以我去了:

C:\Users\'YourName'\.spyder2-py3

delete every spyder, lock file/folder in it and relaunch.

删除每个 spyder,锁定其中的文件/文件夹并重新启动。

回答by xuwei

I've got exactly the same error messages before, and I fixed it by installing spyder again under anaconda:

我之前收到过完全相同的错误消息,我通过在 anaconda 下再次安装 spyder 来修复它:

conda install spyder

回答by Y.S

Well it says it is missing PyQt4.dll, which you can check by: searching pyqt4 in your anaconda3 directory. There are several possibilities:

好吧,它说它缺少 PyQt4.dll,您可以通过以下方式进行检查:在 anaconda3 目录中搜索 pyqt4。有几种可能:

  • it is still in: ~\Anaconda3_x86\Library\plugins\designer
  • 它仍然在:~\Anaconda3_x86\Library\plugins\designer

That would mean python can't find since it ain't searching in this directory, I highly doubt that possiblity, since that would mean you'd have tweaked some code.

这意味着python无法找到,因为它不在这个目录中搜索,我非常怀疑这种可能性,因为这意味着你已经调整了一些代码。

  • it ain't anywhere
  • 它不在任何地方

Maybe you or more likely one of your programs did deleted it per accident?

也许您或更可能您的某个程序确实在每次事故中删除了它?

  • it isnt in: ~\Anaconda3_x86\Library\plugins\designer
  • 它不在:~\Anaconda3_x86\Library\plugins\designer

I also doubt this possibilty since it would mean the file has been moved...

我也怀疑这种可能性,因为这意味着文件已被移动......

However you can fix that by reinstalling spyder as mentioned by xuwei.

但是,您可以通过重新安装 xuwei 提到的 spyder 来解决该问题。