我刚刚升级了 ubuntu。结果,spyder 不再工作了。这是错误:
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Traceback (most recent call last):
File "/usr/bin/spyder", line 33, in <module>
sys.exit(load_entry_point('spyder==4.2.1', 'gui_scripts', 'spyder')())
File "/usr/lib/python3/dist-packages/spyder/app/start.py", line 213, in main
mainwindow.main(options, args)
File "/usr/lib/python3/dist-packages/spyder/app/mainwindow.py", line 3624, in main
mainwindow = create_window(app, splash, options, args)
File "/usr/lib/python3/dist-packages/spyder/app/mainwindow.py", line 3482, in create_window
main.setup()
File "/usr/lib/python3/dist-packages/spyder/app/mainwindow.py", line 803, in setup
self.completions = CompletionManager(self)
File "/usr/lib/python3/dist-packages/spyder/plugins/completion/plugin.py", line 97, in __init__
plugin_client = Plugin(self.main)
File "/usr/lib/python3/dist-packages/spyder/plugins/completion/kite/plugin.py", line 50, in __init__
self.installer = KiteInstallerDialog(
File "/usr/lib/python3/dist-packages/spyder/plugins/completion/kite/widgets/install.py", line 287, in __init__
self._integration_widget = KiteIntegrationInfo(self)
File "/usr/lib/python3/dist-packages/spyder/plugins/completion/kite/widgets/install.py", line 58, in __init__
image = image.scaled(image_width, image_height, Qt.KeepAspectRatio,
TypeError: arguments did not match any overloaded call:
scaled(self, int, int, aspectRatioMode: Qt.AspectRatioMode = Qt.IgnoreAspectRatio, transformMode: Qt.TransformationMode = Qt.FastTransformation): argument 1 has unexpected type 'float'
scaled(self, QSize, aspectRatioMode: Qt.AspectRatioMode = Qt.IgnoreAspectRatio, transformMode: Qt.TransformationMode = Qt.FastTransformation): argument 1 has unexpected type 'float'
这似乎是一个错误(这里)
你有什么建议?我可以降级 spyder 吗?这是一个可行的解决方案吗?
最好的
答案1
This is a Python 3.10 problem, not a Spyder problem necessarily.
这条评论由 Thomas Ward 对主要问题发表,在我看来是正确的,因为除了在 Python 虚拟环境中安装 Spyder 5 应用程序外,我无法在 macOS 或 Ubuntu 中成功运行它。
按照这些说明在所有当前支持的 Ubuntu 版本中安装最新版本的 Spyder(当前为 Spyder 5.x)。
安装 Python 3 虚拟环境创建器。
sudo apt install python3-virtualenv
运行
python3 --version
以显示 Python 3.x 版本。在 Ubuntu 22.04 中,默认的 Python 3.x 版本是 Python 3.10,我将在下一步中使用它作为示例。为 Python 3 创建一个 Python 虚拟环境。
virtualenv -p python3.10 venv source ./venv/bin/activate
venv
将在当前目录的目录中创建针对python3.10的新的Python虚拟环境。安装最新版本的 Spyder。
pip3 install spyder