【问题标题】:Can no Longer open Spyder IDE for Python Programming无法再打开 Spyder IDE 进行 Python 编程
【发布时间】:2016-07-20 02:56:49
【问题描述】:

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

但是,从昨天开始,我一直无法打开 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

我再次双击 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

这两条消息都闪得很快,然后又消失了——当它们出现时,我通过快速按下 Print Screen 来捕捉它们。我不清楚错误消息意味着什么,也不清楚是什么原因造成的。可能是我在某些功能运行时关闭了 Spyder,或者 Spyder 崩溃并导致了一些持续性错误。有谁知道我该如何解决这个问题?

【问题讨论】:

  • 从未听说过 Spyder,但您看过 PyScripter 吗?
  • 不,但我会检查一下。在尝试让 Spyder 工作的同时,我可能会寻找新的 IDE。
  • 我安装了 PyScripter。开始菜单为 PyScripter 提供了 3 个选项:1) Pyscripter for Python 2.7 2) Pyscripter for Python 3.4 3) Pyscripter for latest Python Version。第一个和第三个正确打开。第二个给我以下错误消息:错误193:无法打开Dll“python34.dll”,然后“Python无法正确初始化。我们必须退出”
  • 那么,您的 Python 3.4 安装听起来好像有些问题。此时我会尝试卸载并重新安装 Python 3.4。
  • 对于一个好的 python IDE,检查 PyCharm。 jetbrains.com/pycharm

标签: python spyder


【解决方案1】:

我遇到了类似的 Spyder 2 无法启动的问题。我的安装是 Anaconda 的一部分,在 Win7 64 位操作系统上。我尝试了此处列出的所有解决方案和here,但它们对我不起作用。在命令行中,尝试重置 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.

让我吃惊的是,spyder 直到昨天都运行良好,而我昨天刚刚做了一个完整的更新,如下所示:

conda update --all

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

conda update spyder

然后向我展示了以下一揽子计划:

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

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

【讨论】:

    【解决方案2】:

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

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

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

    【讨论】:

      【解决方案3】:

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

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

      【讨论】:

        【解决方案4】:

        我遇到了同样的问题。以下对我有用 请关闭 Spyder IDE,在 Anaconda Prompt 运行

        conda update spyder
        

        然后

        spyder --reset
        

        重启 Spyder

        【讨论】:

        • 在我的情况下,我能够通过运行 conda update spyder 而不使用 spyder --reset 再次启动 spyder IDE。
        【解决方案5】:

        我的解决方案:

        1. 我卸载了 Anaconda spyder

        2. 删除了它的所有目录 c: 程序/ 和 c:users/用户名/ 和 c:users/username/AppData/local 和 c:users/username/AppData/

        3. 我下载了更新版本的 Anaconda Spyder 并安装了它。 现在一切都好。

        【讨论】:

          【解决方案6】:

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

          conda install spyder
          

          【讨论】:

            【解决方案7】:

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

            • 它仍在:~\Anaconda3_x86\Library\plugins\designer

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

            • 它不在任何地方

            也许您或更可能是您的某个程序意外删除了它?

            • 它不在:~\Anaconda3_x86\Library\plugins\designer

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

            但是你可以通过 xuwei 提到的重新安装 spyder 来解决这个问题。

            【讨论】:

              【解决方案8】:

              如果您运行,您可能会获得更多信息

              from spyder.app import start
              start.main()
              

              作为 python 脚本。例如我得到以下输出:

              Traceback (most recent call last):
                File "C:\python_env\workspace\TechDiff\src\demo.py", line 1, in <module>
                  from spyder.app import start
                File "C:\python_env\App\WinPython\python-3.10.1.amd64\lib\site-packages\spyder\app\start.py", line 24, in <module>
                  from spyder.config.base import get_conf_path, running_in_mac_app
                File "C:\python_env\App\WinPython\python-3.10.1.amd64\lib\site-packages\spyder\config\base.py", line 25, in <module>
                  from spyder.utils import encoding
                File "C:\python_env\App\WinPython\python-3.10.1.amd64\lib\site-packages\spyder\utils\encoding.py", line 23, in <module>
                  from spyder.py3compat import (is_string, to_text_string, is_binary_string,
                File "C:\python_env\App\WinPython\python-3.10.1.amd64\lib\site-packages\spyder\py3compat.py", line 77, in <module>
                  from collections import MutableMapping
              ImportError: cannot import name 'MutableMapping' from 'collections' (C:\python_env\App\WinPython\python-3.10.1.amd64\lib\collections\__init__.py)
              

              => 也许对于 Python 3.10,集合的导入需要修复。 => 尝试使用 3.9

              【讨论】:

                猜你喜欢
                • 2016-10-11
                • 2018-11-05
                • 2020-10-21
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 2018-08-16
                • 1970-01-01
                • 1970-01-01
                相关资源
                最近更新 更多