简体   繁体   English

使pygtksourceview在Windows中工作

[英]Making pygtksourceview work in windows

So, I'm trying to get gtksourceview python bindings work under windows (I'm developing a cross platform gtk application that shows code, so gtksourceview seemed like a natural choice). 因此,我试图在Windows下运行gtksourceview python绑定(我正在开发一个显示代码的跨平台gtk应用程序,因此gtksourceview似乎是很自然的选择)。

I have pygtk installed and working (I followed the instructions in http://www.pygtk.org/downloads.html ) 我已经安装了pygtk并且可以正常工作(我按照http://www.pygtk.org/downloads.html中的说明进行操作)

I tried the instructions in http://projects.gnome.org/gtksourceview/ for gtksourceview. 我尝试了gtksourceview的http://projects.gnome.org/gtksourceview/中的说明。

Here is what I did: 这是我做的:

  1. Downloaded and extracted the latest gtksourceview window binaries from: http://ftp.gnome.org/pub/gnome/binaries/win32/gtksourceview/2.10/gtksourceview-2.10.0.zip 从以下站点下载并提取了最新的gtksourceview窗口二进制文件: http : //ftp.gnome.org/pub/gnome/binaries/win32/gtksourceview/2.10/gtksourceview-2.10.0.zip

  2. The website said gtksourceview needs libxml, so I downloaded and extracted the latest libxml window binaries from: http://xmlsoft.org/sources/win32/libxml2-2.7.6.win32.zip 该网站说gtksourceview需要libxml,因此我从http://xmlsoft.org/sources/win32/libxml2-2.7.6.win32.zip下载并提取了最新的libxml窗口二进制文件。

  3. Added the folders containing dll files to the PATH (in my computer they were c:\\opt\\gtksourceview\\bin; C:\\opt\\libxml2-2.7.6.win32\\bin) 将包含dll文件的文件夹添加到PATH(在我的计算机中,它们是c:\\ opt \\ gtksourceview \\ bin; C:\\ opt \\ libxml2-2.7.6.win32 \\ bin)

  4. Installed pygtksourceview with the windows installer: http://ftp.gnome.org/pub/gnome/binaries/win32/pygtksourceview/2.10/pygtksourceview-2.10.0.win32-py2.6.exe 使用Windows安装程序安装pygtksourceview: http ://ftp.gnome.org/pub/gnome/binaries/win32/pygtksourceview/2.10/pygtksourceview-2.10.0.win32-py2.6.exe

  5. Renamed the file libxml2.dll to libxml2-2.dll (after running depends on the gtksourceview dll) 将文件libxml2.dll重命名为libxml2-2.dll(运行后取决于gtksourceview dll)

Now, the gtksouceview widget seems to work, until I'm trying to set the code's language. 现在,gtksouceview小部件似乎可以正常工作,直到我尝试设置代码的语言。 When I do that python crashes. 当我这样做时,python崩溃了。

Here is how I crash it in the console (the simplest way i could come up with): 这是我如何在控制台中将其崩溃(我能想到的最简单的方法):

>>>import gtksourceview2
>>>lang = gtksourceview2.language_manager_get_default().get_language('cpp')
>>>lang.get_style_ids() 

I'm hoping I'm not the first person to use gtksourceview in python on windows. 我希望我不是第一个在Windows上的python中使用gtksourceview的人。 Any ideas what I should try? 任何想法我应该尝试什么?

So in case anyone else is wondering -- I grabbed the wrong libxml dll. 因此,以防万一其他人想知道-我抓错了libxml dll。 The right one is in: http://ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/libxml2_2.7.7-1_win32.zip 正确的文件位于: http : //ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/libxml2_2.7.7-1_win32.zip

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

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