如何解决这个错误。无法加载共享库,符号未定义

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

我有一个python脚本,用pyinstaller转换成一个 "可执行文件"。这个可执行文件在我的电脑上运行时没有任何问题,但在另一台电脑上运行时,其中一个使用gtk和wnck的线程似乎停止了工作。当它在另一台电脑上运行时,其中一个线程似乎在使用gtk和wnck的地方停止工作。

Failed to load shared library 'libwnck-3.so.0' referenced by the typelib: usrlibx86_64-linux-gnulibwnck-3.0.so.0: undefined symbol: gdk_display_get_monitor_at_window

当可执行文件在另一台电脑的终端上运行时(我想是在读取导入语句时),就会显示上述警告。

当运行到以下一行时,就会抛出一个错误。

screen = Wnck.Screen.get_default()

version of libgtk-3-0: 3.18.9

Other computer uses - Ubuntu 18.04.4 bionic 无法定位wnck_screen_get_default: usrlibx86_64-linux-gnulibwnck-3.0.so.0: undefined symbol: gdk_display_get_monitor_at_window (1)

import gi
gi.require_version('Wnck', '3.0')
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Wnck

def my_window():
    screen = Wnck.Screen.get_default()  -- this line throws error
    screen.force_update()
    while True:
        time.sleep(.5)
        while Gtk.events_pending():
            Gtk.main_iteration()
        new_window = screen.get_active_window()
        ....
        ....

以下函数在发生错误的地方进行了线程操作

我使用的是 - Ubuntu 16.04, xenial.

python linux gtk shared-libraries wnck
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.