无法运行 Spyder,因为没有名为“PySide”的模块

问题描述 投票:0回答:6

我想尝试使用 Spyder IDE。我正在阅读此页面,了解如何打开和运行 Spyder:https://github.com/spyder-ide/spyder/releases

我按照页面中的指定输入了以下命令:

conda update qt pyqt
conda update spyder

两个命令都给出了“# 所有请求的软件包已安装。”。

然后我在我的终端(Mac)中输入spyder:

Macs-MacBook:~ macuser$ spyder
Traceback (most recent call last):
  File "/anaconda3/lib/python3.6/site-packages/qtpy/__init__.py", line 166, in <module>
    from PySide import __version__ as PYSIDE_VERSION  # analysis:ignore
ModuleNotFoundError: No module named 'PySide'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/anaconda3/bin/spyder", line 11, in <module>
    sys.exit(main())
  File "/anaconda3/lib/python3.6/site-packages/spyder/app/start.py", line 159, in main
    from spyder.app import mainwindow
  File "/anaconda3/lib/python3.6/site-packages/spyder/app/mainwindow.py", line 49, in <module>

所以,我尝试安装PySide:

Macs-MacBook:~ macuser$ conda install PySide
Solving environment: failed

UnsatisfiableError: The following specifications were found to be in conflict:
  - anaconda==5.2.0=py36_3
  - pyside
Use "conda info <package>" to see the dependencies for each package.

我应该怎样做才能启动并运行 Spyder?

python spyder
6个回答
9
投票

尝试以下命令让我知道它是否有效。

 pip install msgpack
 conda install qt=5.6 pyqt=5.6 sip=4.18

2
投票

虽然在网上找到的其他解决方案对我不起作用(例如上面的解决方案并使用

$ pip install pyqt5
),但我通过使用 pip 通过终端卸载并重新安装 Spyder 解决了这个问题。


$ pip uninstall spyder
...

$ pip install spyder
...

不知道为什么,但第一次尝试就成功了。


1
投票

J先生

我和Doug Fir有同样的问题。我使用了这些命令。我从 DOS 提示符启动了spyder。我收到“RuntimeError:模块根据 API 版本 0xb 编译,但此版本的 numpy 为 0xa”,与之前的情况一样。正当我翻白眼时,Spyder 开始了。所以我认为它有效。


0
投票

尝试删除 .condarc 文件。我不知道具体原因,但我遇到了同样的问题,当我删除 .condarc 文件时,它对我有用。


0
投票

我在 Linux 上遇到了同样的错误并解决了删除问题:

rm -rf .local/lib/python3.9/
rm -rf .local/share/Spyder/

0
投票

我在 Windows 10 上遇到了同样的错误,我发现这确实很有帮助:https://github.com/spyder-ide/spyder/issues/18066 简而言之,@ccordoba12 说“这个错误通常会出现,因为你安装了 pyqt5在某个时刻与点。”你关注他们发布的视频(https://www.youtube.com/watch?v=Ul79ihg41Rs),最重要的是在2:39(step3),按照视频中的说明删除文件夹“/AppData/Roaming/python”下的内容。之后我的问题就完美解决了。希望这能帮助其他遇到同样问题的 Windows 用户!

© www.soinside.com 2019 - 2024. All rights reserved.