![更新至 14.04 后系统配置打印机损坏](https://linux22.com/image/1102241/%E6%9B%B4%E6%96%B0%E8%87%B3%2014.04%20%E5%90%8E%E7%B3%BB%E7%BB%9F%E9%85%8D%E7%BD%AE%E6%89%93%E5%8D%B0%E6%9C%BA%E6%8D%9F%E5%9D%8F.png)
在我升级到 Ubuntu 14.04 之后,gnome 中的系统配置打印机对话框在从命令行调用时遇到问题:
sudo system-config-printer
Traceback (most recent call last):
File "/usr/share/system-config-printer/system-config-printer.py", line 72, in <module>
from gi.repository import GObject # for TYPE_STRING and TYPE_PYOBJECT
File "/usr/lib/python2.7/dist-packages/gi/__init__.py", line 32, in <module>
raise ImportError('When using gi.repository you must not import static '
ImportError: When using gi.repository you must not import static modules like "gobject". Please change all occurrences of "import gobject" to "from gi.repository import GObject".
当我尝试更改包中建议的导入时,问题仍然存在,即
cd /usr/share/system-config-printer
sed -i 's/import gobject/from gi.repository import GObject/g' *.py
sed -i 's/gobject/GObject/g' *.py
感谢您的帮助。
答案1
修改系统文件不是一个好主意,而是先检查您是否拥有相应系统的最新版本包裹:
dpkg-query -W system-config-printer-gnome
它应该返回:
system-config-printer-gnome 1.4.3+20140219-0ubuntu2.1
然后尝试使用 apt-get 重新安装该软件包:
sudo apt-get update
sudo apt-get install --reinstall system-config-printer-gnome