Ubuntu22.04无法打开Spyder:TypeError: arguments did not match any overloaded call

Posted Z.Q.Feng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu22.04无法打开Spyder:TypeError: arguments did not match any overloaded call相关的知识,希望对你有一定的参考价值。

文章目录


一、项目场景

在将 Ubuntu 升级到 22.04 后,常用的 Spyder 编辑器通过图标无法打开了,在 Terminal 中启动 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'

应该是由于 Ubuntu 升级到 22.04 后系统默认 Python 版本为 3.10.4,导致 PyQt 的配置出现了问题。


二、解决办法

修改 /usr/lib/python3/dist-packages/spyder/plugins/completion/kite/widgets/install.py 文件,首先备份一份该文件:

suod cp /usr/lib/python3/dist-packages/spyder/plugins/completion/kite/widgets/install.py /usr/lib/python3/dist-packages/spyder/plugins/completion/kite/widgets/install.py.bak

接着修改该文件:

sudo gedit /usr/lib/python3/dist-packages/spyder/plugins/completion/kite/widgets/install.py

修改内容如下,主要是注释部分代码:

第58行:

# image = image.scaled(image_width, image_height, Qt.KeepAspectRatio, Qt.SmoothTransformation)

第143行:

# install_gif.setScaledSize(QSize(image_width, image_height))

第244-247行

# copilot_label.setPixmap(
	#    copilot_image.scaled(image_width, image_height,
    #                         Qt.KeepAspectRatio,
    #                         Qt.SmoothTransformation))

保存修改,问题解决。

开发者涨薪指南 48位大咖的思考法则、工作方式、逻辑体系

以上是关于Ubuntu22.04无法打开Spyder:TypeError: arguments did not match any overloaded call的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu22.04无法打开Spyder:TypeError: arguments did not match any overloaded call

Ubuntu VNC 打开spyder无法输入(检测不到键盘配置)解决方法

解决方法:Ubuntu 22.04网络无法连接,没有网络图标

解决方法:Ubuntu 22.04网络无法连接,没有网络图标

解决方法:Ubuntu 22.04网络无法连接,没有网络图标

Ubuntu22.04 在 VMware 17 无法实现拖放复制操作解决办法