简体   繁体   English

gi.repository Windows

[英]gi.repository Windows

I'm developing an app which has to be 100% compatible on windows and on linux. 我正在开发一个必须在Windows和Linux上100%兼容的应用程序。 On linux I have no problems, but on windows I came up with this message: from gi.repository import Gtk ImportError: No module named gi 在linux上,我没有问题,但是在Windows上,我想到了以下消息:从gi.repository import Gtk ImportError:没有名为gi的模块

I installed pygobject, pygtkallinone, gtk.. what am I missing? 我安装了pygobject,pygtkallinone,gtk ..我缺少什么?

Most of Havok answer is correct, except that documentation has been improved a lot lately, with a Tutorial: 大多数Havok答案都是正确的,除了最近的文档使用Tutorial改进了很多:

Including a PDF version for offline reading: 包括PDF版本以供离线阅读:

And a complete API reference manual, not only of Gtk but also many other libraries that you can use with introspection: 以及完整的API参考手册,不仅是Gtk的手册,还包括可用于自省的许多其他库:

on windows the support is great, a lot of effort has been put in creating all the windows executables and libraries, the last release of pygi-aio is 3.10.6: 在Windows上,它的支持很棒,在创建所有Windows可执行文件和库上已经付出了很多努力,pygi-aio的最新版本是3.10.6:

I've also put instructions on the Gnome wiki on how to build on win32 with pygobject introspection, it's not that hard, I've also uploaded a setup.py that actually works: 我还在Gnome Wiki上发布了有关如何使用pygobject自省在win32上进行构建的说明,这并不难,我还上传了一个有效的setup.py:

So the answer is, don't go with PyGTK 所以答案是,不要与PyGTK一起使用

gi.repository module is called PyGObject and is for Gtk+3 and is not yet available for Windows (there has been experiments, but is not ready AFAIK). gi.repository模块称为PyGObject ,适用于Gtk + 3,尚不适用于Windows(已进行实验,但尚未准备好AFAIK)。 https://live.gnome.org/PyGObject https://live.gnome.org/PyGObject

gtk module is called PyGtk and is for Gtk+2 and is very mature on Windows platforms (in particular 2.24). gtk模块称为PyGtk ,用于Gtk + 2,在Windows平台(特别是2.24)上非常成熟。 http://www.pygtk.org/ http://www.pygtk.org/

What's the difference? 有什么不同?

  • PyGObject has some scarse Windows support. PyGObject对Windows缺乏支持。 PyGtk has great support for this OS. PyGtk对此操作系统提供了强大的支持。
  • PyGObject is what is called a dynamic binding and PyGtk is a static one. PyGObject是动态绑定,PyGtk是静态绑定。
  • PyGObject is new and the future and PyGtk is the past, mature and some day will be deprecated. PyGObject是新的和未来,而PyGtk是过去,成熟并且有一天将被弃用。
  • PyGObject documentation and examples are very very limited, and PyGtk one are very very complete: http://developer.gnome.org/pygtk/stable/ PyGObject文档和示例非常有限,而PyGtk则非常完整: http//developer.gnome.org/pygtk/stable/
  • They are not compatible, you can't use both and you need to choose one. 它们不兼容,您不能同时使用两者,而需要选择一个。
  • PyGObject is in active development, no new features will be introduced for PyGtk. PyGObject正在积极开发中,不会为PyGtk引入任何新功能。
  • If you use Glade, the lastest version will be for PyGObject (for example 3.12.1). 如果使用Glade,则最新版本将用于PyGObject(例如3.12.1)。 If you want to use Glade for PyGtk install the 3.8.0 version. 如果要将Glade用于PyGtk,请安装3.8.0版本。

If you choose to go PyGtk there is great support for freezing the application. 如果您选择使用PyGtk,则可以冻结应用程序。 You can check my documentation and support files for my application here: http://sourceforge.net/p/nestededitor/code/247/tree/trunk/dist/windows/ 您可以在这里查看我的应用程序的文档和支持文件: http : //sourceforge.net/p/nestededitor/code/247/tree/trunk/dist/windows/

Hope it helps. 希望能帮助到你。

EDIT: 编辑:

Many things have changed in two years. 两年来,许多事情发生了变化。 Please see gianmt answer. 请参阅gianmt答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM