我有一个运行中的python程序,它使用安装在自制软件中的GTK3。在更新我的OSX系统之后,我现在得到了错误:
import gi
File "/usr/local/lib/python2.7/site-packages/gi/__init__.py", line 42, in <module>
ImportError: cannot import name _gi
产生此错误的最小示例是:
# import_gi.py
import gi
print gi.__dict__
它产生:
=> /usr/local/Cellar/python\@2/2
我正在尝试从python (3.4)中的libgda开始。要导入Gda模块,我要执行from gi.repository import Gda
我想使用GdauiTreeStore,但我不知道如何导入Gda模块.
这样的事情行不通:
from gi.repository import Gdaui
from gi.repository import GdaUi
from gi.repository import GdaUI
from gi.repository import Gda-ui
from gi.repository import Gda-Ui
from gi.r
我尝试使用here中的以下简单代码: import Data.GI.Base
import qualified GI.Gtk as Gtk
main :: IO()
main = do
Gtk.init Nothing
Gtk.main 但是,我得到了以下错误: Could not find module `Data.GI.Base'
Use -v to see a list of the files searched for.
|
1 | import Data.GI.Base
| ^^^^^^^^^^^^^^^^^^^
simplewin.hs
我将我的python3版本更新为3.10,现在我的便条出现了这个错误
Traceback (most recent call last):
File "/usr/bin/indicator-stickynotes", line 21, in <module>
from stickynotes.gui import *
File "/usr/share/indicator-stickynotes/stickynotes/gui.py", line 20, in <module>
import gi
File
对于libnotify,我使用以下代码
import gi
gi.require_version('Notify', '0.7')
from gi.repository import Notify
然后flake8抱怨说:
E402 module level import not at top of file
另一方面,在使用gi:时必须指定版本。
我该怎么办?忽略林特的消息或删除gi.require_version行?
我试图像这样改进Gtk:from gi.repository import Gtk
我得到了以下错误:
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"
当我尝试from gi.repository import GObject时,我会得到同样的
这是问题吗? 16.04
sudo update-manager -c
[sudo] password for charles:
/usr/bin/update-manager:28: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
from gi.repository import
我已经在Ubuntu17.10上安装了Kazam (版本1.4.5),我无法启动它。当我试图从命令行运行时,我会收到以下消息:
gonczor@wiktor-papu:~$ kazam
/usr/bin/kazam:32: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
from g
升级到Ubuntu14.04之后,gnome中的对话框system打印机在从命令行调用时遇到了问题:
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
看起来,当我想切换到python3.8时,我已经中断了我的python安装。使用Ubuntu 18.04。尝试使用gi时,会出现以下错误:
$ python
Python 3.8.1 (default, Dec 31 2019, 18:42:42)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import GLib, Gio
我想测试kazam (屏幕广播程序),所以我尝试从源代码中启动它。
在kazam目录中,我完成了以下操作:
python app.py`
但除了一些关于gtk的警告外,什么都没有发生。有可能吗?
app.py:24: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
app.py:33: PyGIWarning: Gtk was imported without
我对Ubuntu相当陌生,我试图在Ubuntu13.10上运行更新管理器。我得到:
jacopo@jacopo-laptop:~$ update-manager
Traceback (most recent call last):
File "/usr/bin/update-manager", line 28, in <module>
from gi.repository import Gtk
File "/usr/lib/python3/dist-packages/gi/__init__.py", line 27, in <
我正在学习Python,在开发我的应用程序时积累的导入看起来像是在重复导入。请有人可以建议我的开发实践。
from pathlib import Path
from urllib.request import urlopen
from gi.repository import Gtk, Gio
from gi.repository import GLib as glib
from gtk_assistant import AssistantApp
import urllib.request
import urllib.error
import xml.etree.ElementTree as
我有16.04.1 LTS。安装系统后,我做了以下操作:
更新-替代品--删除python /usr/bin/python 2
更新-替代品--安装/usr/bin/python python /usr/bin/python 3
但由于以下问题,我现在无法更新系统、程序和包:
sudo apt-get dist-upgrade
Чтение списков пакетов… Готово
Построение дерева зависимостей
Чтение информации о состоянии… Готово
Расчёт обновлений… Готово
我需要帮助设置Windows下的PyGObject。我有,但是当从gi.repository导入Gtk和Gdk时会出现以下错误
ERROR:root:Could not find any typelib for Gtk
Traceback (most recent call last):
File "example.py", line 2, in <module>
from gi.repository import Gtk
ImportError: cannot import name Gtk
我能够导入gi.repository.GLib、gi.rep
我试着跑快步,我试着写‘快步’命令,但是它给我显示了这样的消息:
/home/quickly_trunk/lightread/__init__.py:40: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
from gi.repository import Gtk, Gio # py
当我尝试从Gauke终端或XTerm打开终端时,请使用
gnome-terminal
它显示了这个错误:
Traceback (most recent call last):
File "/usr/bin/gnome-terminal", line 9, in
from gi.repository import GLib, Gio
File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in
from . import _gi
ImportError: cannot
我得到了这些未解决的导入,
from gi.repository import GLib, GObject, Gio
from gi.repository import Dee
from gi.repository import Unity
我一直在学习为unity编写镜头(Ubuntu)。从哪里/如何获取这些模块并将它们链接起来?
我刚从Fedora 30升级到Fedora 32。我所有的python东西都停止工作了。第一个问题是
import gtk
我读到我应该把它换成
from gi.repository import Gtk as gtk
from gi.repository import Gdk
但是很多很多的模块都不存在。例如:
AttributeError: 'gi.repository.Gtk' object has no attribute 'combo_box_new_text'
AttributeError: 'gi.repository.Gtk' o
我正在尝试为linux中的mate-panel制作一个applet。我必须对Window.py和Applet.py进行模块化。我得到了这个错误:
Traceback (most recent call last):
File "./Applet.py", line 37, in WindowButtonsAppletFactory
WindowButtonsApplet(applet)
File "./Applet.py", line 23, in WindowButtonsApplet
CloseButton.connect("Clicked"
我们正在尝试将从gtk2移植到gtk3。当我尝试pygi-convert.sh时,我得到了以下错误:
Traceback (most recent call last):
File "scripts/amir", line 53, in <module>
from gi.repository import GObject
File "/usr/lib/python2.7/dist-packages/gi/__init__.py", line 39, in <module>
raise ImportError(_st
我正在尝试运行以下程序: import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst 但是我得到了: Traceback (most recent call last):
File "application.py", line 2, in <module>
import gi
ModuleNotFoundError: No module named 'gi' 我在使用Python3的Mac Sierra
我试着给普什佩尔做个指示灯,但没有用。当我注意到python3无法导入gi时,我试图通过终端运行。
bin > python3 pushbullet-indicator
Traceback (most recent call last):
File "pushbullet-indicator", line 26, in <module>
import gi
ImportError: No module named 'gi'
bin >
尝试手动导入。
~ > python3
Python 3.4.1 (default, Se
我使用ppa:fioan89 89/幻灯片墙在Ubuntu16.04上安装了幻灯片墙。
我还安装了python-app指示器、、python 2、python。但是滑动墙不起作用。
以下是我收到的错误:
$ /opt/extras.ubuntu.com/slidewall/bin/slidewall
/opt/extras.ubuntu.com/slidewall/slidewall/__init__.py:23: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version(&
在没有成功的情况下,我正在运行这个代码。
import sys
sys.setrecursionlimit(2147483647)
Gi = 0
def recur():
global Gi
Gi = Gi + 1
recur()
recur()
print(Gi)
input()
我知道更改递归限制是没有好处的,但是我从未想过这会导致Shell崩溃。有人知道为什么吗?
我是否有不完整的安装?
$ sudo update-manager -d
sys:1: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
sys:1: PyGIWarning: GdkX11 was imported without specifying a version first. U
我使用的是基本操作系统,我想使用python3发布自己的通知,我知道一个简单的方法是使用import subprocess。然而,在网上阅读时,我发现这不是最合适的方法。相反,我应该使用from gi.repository import Notify,但是我得到了这个错误
__main__:1: PyGIWarning: Notify was imported without specifying a version first. Use gi.require_version('Notify', '0.7') before import to ensure t