Spyder 在调试模式下非常慢

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

Python 3.10.6,Spyder 5.4.3

减速大约是 20 倍。这是一个新的、干净的独立安装;详情如下。我在网上找不到任何关于此问题的报告,如有任何见解,我们将不胜感激。

其他一切正常,可以在spyder中运行程序,执行时间正常,但在debug中运行时,即使没有设置断点,速度也会下降20倍或更多。不知道如何解决这个问题。

这是对 ubuntu 22.04 的全新升级。包含的 spyder 并未在该版本中启动,所以我按照此处的说明进行操作:

https://docs.spyder-ide.org/current/installation.html#using-pip

 sudo apt-get purge --auto-remove spyder
 python3 -m venv spyder-env
 source spyder-env/bin/activate
 pip install spyder numpy scipy pandas matplotlib sympy cython
(spyder-env) ~$ pip list
Package                       Version
----------------------------- ---------
alabaster                     0.7.13
arrow                         1.2.3
astroid                       2.15.3
asttokens                     2.2.1
atomicwrites                  1.4.1
attrs                         23.1.0
autopep8                      2.0.2
Babel                         2.12.1
backcall                      0.2.0
beautifulsoup4                4.12.2
binaryornot                   0.4.4
black                         23.3.0
bleach                        6.0.0
certifi                       2022.12.7
cffi                          1.15.1
chardet                       5.1.0
charset-normalizer            3.1.0
click                         8.1.3
cloudpickle                   2.2.1
comm                          0.1.3
contourpy                     1.0.7
cookiecutter                  2.1.1
cryptography                  40.0.2
cycler                        0.11.0
Cython                        0.29.34
debugpy                       1.6.7
decorator                     5.1.1
defusedxml                    0.7.1
diff-match-patch              20200713
dill                          0.3.6
docstring-to-markdown         0.12
docutils                      0.19
executing                     1.2.0
fastjsonschema                2.16.3
flake8                        6.0.0
fonttools                     4.39.3
idna                          3.4
imagesize                     1.4.1
importlib-metadata            6.6.0
inflection                    0.5.1
intervaltree                  3.1.0
ipykernel                     6.22.0
ipython                       8.12.0
ipython-genutils              0.2.0
isort                         5.12.0
jaraco.classes                3.2.3
jedi                          0.18.2
jeepney                       0.8.0
jellyfish                     0.11.2
Jinja2                        3.1.2
jinja2-time                   0.2.0
jsonschema                    4.17.3
jupyter_client                8.2.0
jupyter_core                  5.3.0
jupyterlab-pygments           0.2.2
keyring                       23.13.1
kiwisolver                    1.4.4
lazy-object-proxy             1.9.0
MarkupSafe                    2.1.2
matplotlib                    3.7.1
matplotlib-inline             0.1.6
mccabe                        0.7.0
mistune                       2.0.5
more-itertools                9.1.0
Mosek                         10.0.40
mpmath                        1.3.0
mypy-extensions               1.0.0
nbclient                      0.7.3
nbconvert                     7.3.1
nbformat                      5.8.0
nest-asyncio                  1.5.6
numpy                         1.24.3
numpydoc                      1.5.0
packaging                     23.1
pandas                        2.0.0
pandocfilters                 1.5.0
parso                         0.8.3
pathspec                      0.11.1
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        9.5.0
pip                           22.0.2
platformdirs                  3.2.0
pluggy                        1.0.0
prompt-toolkit                3.0.38
psutil                        5.9.5
ptyprocess                    0.7.0
pure-eval                     0.2.2
pyarrow                       11.0.0
pycodestyle                   2.10.0
pycparser                     2.21
pydocstyle                    6.3.0
pyflakes                      3.0.1
Pygments                      2.15.1
pylint                        2.17.2
pylint-venv                   3.0.1
pyls-spyder                   0.4.0
pyparsing                     3.0.9
PyQt5                         5.15.9
PyQt5-Qt5                     5.15.2
PyQt5-sip                     12.12.1
PyQtWebEngine                 5.15.6
PyQtWebEngine-Qt5             5.15.2
pyrsistent                    0.19.3
python-dateutil               2.8.2
python-lsp-black              1.2.1
python-lsp-jsonrpc            1.0.0
python-lsp-server             1.7.2
python-slugify                8.0.1
pytoolconfig                  1.2.5
pytz                          2023.3
pyxdg                         0.28
PyYAML                        6.0
pyzmq                         25.0.2
QDarkStyle                    3.1
qstylizer                     0.2.2
QtAwesome                     1.2.3
qtconsole                     5.4.2
QtPy                          2.3.1
requests                      2.28.2
rope                          1.7.0
Rtree                         1.0.1
scipy                         1.10.1
SecretStorage                 3.3.3
setuptools                    59.6.0
six                           1.16.0
snowballstemmer               2.2.0
sortedcontainers              2.4.0
soupsieve                     2.4.1
Sphinx                        6.1.3
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.1
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
spyder                        5.4.3
spyder-kernels                2.4.3
stack-data                    0.6.2
sympy                         1.11.1
text-unidecode                1.3
textdistance                  4.5.0
three-merge                   0.1.1
tinycss2                      1.2.1
toml                          0.10.2
tomli                         2.0.1
tomlkit                       0.11.7
tornado                       6.3.1
traitlets                     5.9.0
typing_extensions             4.5.0
tzdata                        2023.3
ujson                         5.7.0
urllib3                       1.26.15
watchdog                      3.0.0
wcwidth                       0.2.6
webencodings                  0.5.1
whatthepatch                  1.0.4
wrapt                         1.15.0
wurlitzer                     3.0.3
yapf                          0.32.0
zipp                          3.15.0
python spyder
2个回答
0
投票

使用调试器时,预计会出现这些类型的性能下降。您会发现,无论您使用何种文本编辑器、编程语言或调试工具,情况都是如此。性能变慢是因为调试器需要监视正在运行的程序的行为,以便可以根据需要暂停和检查它,这需要在操作之间进行额外的检查,并且还意味着编译器无法执行尽可能多的代码优化(因为它们会破坏调试器)。


0
投票

问题出在最新版本的 Spyder 5.4.3 和 5.2.2

提交到github: https://github.com/spyder-ide/spyder/issues/20862

在调试模式下,Spyder 5.4.3 中的 pandas 执行速度降低了 30 倍,而在 5.2.2 中仅为 4 倍

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