如何修复 Ubuntu 上的 Python 'ValueError: Namespace GnomeDesktop not available'
问题:
在 Ubuntu 上,你正在尝试使用 gi 包和 GnomeDesktop 运行 Python 脚本,但你看到此堆栈跟踪:
error.txt
Traceback (most recent call last):
File "myscript.py", line 48, in <module>
gi.require_version('GnomeDesktop', '3.0')
File "/usr/lib/python3/dist-packages/gi/__init__.py", line 130, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace GnomeDesktop not available解决方案
安装 gir1.2-gnomedesktop-3.0:
install.sh
sudo apt -y install gir1.2-gnomedesktop-3.0然后重试运行你的脚本。
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow