You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Red Hat Linux下Spyder启动失败:PyQt5检测异常求助

问题描述

在Red Hat Linux系统的虚拟环境中,按官方文档安装的Spyder IDE原本运行正常,现在启动时出现报错,Traceback提示需要PyQt5 5.9+但检测到版本为None。但执行python3 -m pip list显示已安装PyQt5 5.12.3。这是一台共享机器,怀疑是他人修改配置导致问题,寻求解决办法。

报错信息

Traceback (most recent call last):
  File "/home/<my_name>/spyder-env/bin/spyder", line 8, in <module>
    sys.exit(main())
  File "/home/<my_name>/spyder-env/lib64/python3.9/site-packages/spyder/app/start.py", line 248, in main
    from spyder.app import mainwindow
  File "/home/<my_name>/spyder-env/lib64/python3.9/site-packages/spyder/app/mainwindow.py", line 41, in <module>
    requirements.check_qt()
  File "/home/<my_name>/spyder-env/lib64/python3.9/site-packages/spyder/requirements.py", line 54, in check_qt
    show_warning("Please check Spyder installation requirements:\n"
  File "/home/<my_name>/spyder-env/lib64/python3.9/site-packages/spyder/requirements.py", line 32, in show_warning
    raise RuntimeError(message)
RuntimeError: Please check Spyder installation requirements:
PyQt5 5.9+ is required (found None).

已安装包列表(含PyQt5)

python3 -m pip list
Package                       Version
----------------------------- -------------------
absl-py                       1.0.0
alabaster                     0.7.12
arrow                         1.2.2
astroid                       2.11.3
asttokens                     2.0.5
astunparse                    1.6.3
atomicwrites                  1.4.0
attrs                         21.4.0
autopep8                      1.6.0
Babel                         2.10.1
backcall                      0.2.0
beautifulsoup4                4.11.1
binaryornot                   0.4.4
black                         22.3.0
bleach                        5.0.0
cachetools                    5.0.0
certifi                       2021.10.8
cffi                          1.15.0
chardet                       4.0.0
charset-normalizer            2.0.12
click                         8.1.3
cloudpickle                   2.0.0
cookiecutter                  1.7.3
cryptography                  37.0.1
cycler                        0.11.0
deap                          1.3.1
debugpy                       1.6.0
decorator                     5.1.1
defusedxml                    0.7.1
Deprecated                    1.2.13
diff-match-patch              20200713
dill                          0.3.4
docutils                      0.17.1
entrypoints                   0.4
executing                     0.8.3
fastjsonschema                2.15.3
flake8                        4.0.1
flatbuffers                   2.0
fonttools                     4.33.3
gast                          0.5.3
google-auth                   2.6.6
google-auth-oauthlib          0.4.6
google-pasta                  0.2.0
grpcio                        1.44.0
h5py                          3.6.0
idna                          3.3
imagesize                     1.3.0
imbalanced-learn              0.9.0
imblearn                      0.0
importlib-metadata            4.11.3
inflection                    0.5.1
intervaltree                  3.1.0
ipykernel                     6.13.0
ipython                       7.32.0
ipython-genutils              0.2.0
isort                         5.10.1
jedi                          0.18.1
jeepney                       0.8.0
jellyfish                     0.9.0
Jinja2                        3.0.3
jinja2-time                   0.2.0
joblib                        1.1.0
jsonschema                    4.4.0
jupyter_client                7.3.5
jupyter-core                  4.10.0
jupyterlab-pygments           0.2.2
keras                         2.8.0
Keras-Preprocessing           1.1.2
keyring                       23.5.0
kiwisolver                    1.4.2
lazy-object-proxy             1.7.1
libclang                      14.0.1
llvmlite                      0.38.1
Markdown                      3.3.6
MarkupSafe                    2.1.1
matplotlib                    3.5.1
matplotlib-inline             0.1.3
mccabe                        0.6.1
mistune                       0.8.4
mypy-extensions               0.4.3
nbclient                      0.6.0
nbconvert                     6.5.0
nbformat                      5.3.0
nest-asyncio                  1.5.5
numba                         0.55.2
numpy                         1.21.6
numpydoc                      1.2.1
oauthlib                      3.2.0
opt-einsum                    3.3.0
packaging                     21.3
pandas                        1.4.3
pandocfilters                 1.5.0
parso                         0.8.3
pathspec                      0.9.0
patsy                         0.5.2
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        9.1.0
pip                           22.2.2
platformdirs                  2.5.2
pluggy                        1.0.0
poyo                          0.5.0
prompt-toolkit                3.0.29
protobuf                      3.20.1
psutil                        5.9.0
ptyprocess                    0.7.0
pure-eval                     0.2.2
pyasn1                        0.4.8
pyasn1-modules                0.2.8
pycodestyle                   2.8.0
pycparser                     2.21
pydocstyle                    6.1.1
pyflakes                      2.4.0
Pygments                      2.12.0
pylint                        2.13.7
pyls-spyder                   0.4.0
PyOpenGL                      3.1.6
pyparsing                     3.0.8
PyQt5                         5.12.3
PyQt5-Qt5                     5.15.2
PyQt5-sip                     12.10.1
PyQtWebEngine                 5.12.1
PyQtWebEngine-Qt5             5.15.2
pyrsistent                    0.18.1
python-dateutil               2.8.2
python-lsp-black              1.2.1
python-lsp-jsonrpc            1.0.0
python-lsp-server             1.5.0
python-slugify                6.1.2
pytz                          2022.1
pyxdg                         0.27
pyzmq                         24.0.1
QDarkStyle                    3.0.3
qstylizer                     0.2.1
QtAwesome                     1.1.1
qtconsole                     5.3.2
QtPy                          2.1.0
requests                      2.27.1
requests-oauthlib             1.3.1
rope                          1.0.0
rsa                           4.8
Rtree                         1.0.0
scikeras                      0.9.0
scikit-learn                  1.0.2
scipy                         1.8.0
seaborn                       0.11.2
SecretStorage                 3.3.2
setuptools                    50.3.2
six                           1.16.0
sklearn                       0.0
sktime                        0.12.0
snowballstemmer               2.2.0
sortedcontainers              2.4.0
soupsieve                     2.3.2.post1
Sphinx                        4.5.0
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
spyder                        5.3.3
spyder-kernels                2.3.3
statsmodels                   0.13.2
stopit                        1.1.2
tensorboard                   2.8.0
tensorboard-data-server       0.6.1
tensorboard-plugin-wit        1.8.1
tensorflow                    2.8.0
tensorflow-io-gcs-filesystem  0.25.0
termcolor                     1.1.0
text-unidecode                1.3
textdistance                  4.2.2
tf-estimator-nightly          2.8.0.dev2021122109
threadpoolctl                 3.1.0
three-merge                   0.1.1
tinycss2                      1.1.1
toml                          0.10.2
tomli                         2.0.1
torch                         1.11.0
torchaudio                    0.11.0
torchvision                   0.12.0
tornado                       6.2
TPOT                          0.11.7
tqdm                          4.64.0
traitlets                     5.1.1
typing_extensions             4.2.0
ujson                         5.2.0
update-checker                0.18.0
urllib3                       1.26.9
varname                       0.8.3
watchdog                      2.1.9
wcwidth                       0.2.5
webencodings                  0.5.1
Werkzeug                      2.1.2
whatthepatch                  1.0.2
wheel                         0.37.1
wrapt                         1.14.0
wurlitzer                     3.0.2
xgboost                       1.6.0
yapf                          0.32.0
zipp                          3.8.0
解决办法
  • 确认虚拟环境激活状态:启动Spyder前必须激活对应虚拟环境,执行source /home/<my_name>/spyder-env/bin/activate(bash/zsh环境)或source /home/<my_name>/spyder-env/bin/activate.csh(csh/tcsh环境),激活后再运行spyder。
  • 强制重装PyQt5及关联依赖:在激活的虚拟环境中执行pip install --force-reinstall PyQt5==5.12.3 PyQt5-sip==12.10.1 PyQtWebEngine==5.12.1,修复可能损坏的安装文件或链接。
  • 检查路径冲突:执行which python和which spyder,确认两者均指向虚拟环境内的路径(/home/<my_name>/spyder-env/bin/目录下),避免系统全局Python干扰。
  • 修复QtPy检测逻辑:Spyder依赖QtPy检测Qt库,执行python -c "import qtpy; print(qtpy.QT_VERSION)",若输出异常则重装QtPy:pip install --force-reinstall QtPy==2.1.0。
  • 重置Spyder配置:执行spyder --reset,清除可能被修改的配置文件,恢复默认状态。
  • 重建虚拟环境:若上述方法无效,先备份环境依赖列表(pip freeze > requirements.txt),再删除原环境重新创建:
    rm -rf /home/<my_name>/spyder-env
    python3 -m venv /home/<my_name>/spyder-env
    source /home/<my_name>/spyder-env/bin/activate
    pip install -r requirements.txt
    pip install spyder==5.3.3
    

内容的提问来源于stack exchange,提问作者kdevine7

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.17 04:10:38